From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id A27648BA5C
 for <pve-devel@lists.proxmox.com>; Fri, 26 Aug 2022 08:48:14 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 984482CC8E
 for <pve-devel@lists.proxmox.com>; Fri, 26 Aug 2022 08:48:14 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Fri, 26 Aug 2022 08:48:14 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D83E4432D8;
 Fri, 26 Aug 2022 08:48:13 +0200 (CEST)
Message-ID: <933d4818-e768-e812-5e4b-85fa1f3b8d69@proxmox.com>
Date: Fri, 26 Aug 2022 08:48:13 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101
 Thunderbird/105.0
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 "DERUMIER, Alexandre" <Alexandre.DERUMIER@groupe-cyllene.com>
References: <20220825092440.1810328-1-d.csapak@proxmox.com>
 <20220825092440.1810328-30-d.csapak@proxmox.com>
 <38ddcb04-c9e8-4804-7ea2-c330e3357258@groupe-cyllene.com>
From: Dominik Csapak <d.csapak@proxmox.com>
In-Reply-To: <38ddcb04-c9e8-4804-7ea2-c330e3357258@groupe-cyllene.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.094 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.001 Looks like a legit reply (A)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: Re: [pve-devel] [PATCH manager v2 11/13] ui: add dc/HardwareView: a
 CRUD interface for hardware mapping
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Fri, 26 Aug 2022 06:48:14 -0000

On 8/25/22 17:37, DERUMIER, Alexandre wrote:
> I don't known if it's a bug in the gui, or the api.
> 
> But, if you update an existing mapping,with currently,a simple function
> pci with mdev=1, and you change it to a pci multifunction with mdev=0,
> 
> the mdev value is not updated.
> 
> (This occur in the other direction too)
> 
> 
> original singly function with mdev=1
> --------
> {
>     "pci": {
>       "sharednvidia": {
>         "pve2": {
>           "path": "0000:02:00.0",
>           "subsystem-vendor": "0x10de",
>           "subsystem-device": "0x131b",
>           "device": "0x1c31",
>           "mdev": "1",
>           "iommugroup": "47",
>           "vendor": "0x10de"
>         },
>       }
>     },
>     "digest": "7e544172eb5487e753672f6511bae9602338de6f"
> }
> 
> 
> after update to multiple function, mdev should be 0 instead 1.
> 
> --------
> {
>     "pci": {
>       "sharednvidia": {
>         "pve2": {
>           "path": "0000:02:00",
>           "subsystem-vendor": "0x10de",
>           "subsystem-device": "0x131b",
>           "device": "0x1c31",
>           "mdev": "1",
>           "iommugroup": "47",
>           "vendor": "0x10de"
>         },
>       }
>     },
>     "digest": "7e544172eb5487e753672f6511bae9602338de6f"
> }
> 

well the api/gui do both the 'right' thing here, but i see what you mean...
in your case the first function '02:00.0' has mediated device support,
so we extract that from there

but we actualy don't want that in the case of a multifunction device
(since later in the code we disallow/ignore it anyway)

thanks for catching :)

maybe we need better ux here too somehow, since currently when you want
to use mdevs, you cannot select the whole device (as a multifunction device)
but have to select the individual functions seperately
(i tried to make that clear with the 'pass through as one device' sentence)