[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 10/13] vpci/header: reset the command register when adding devices
- To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Fri, 4 Feb 2022 15:30:22 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p2MPSfIlWYqNOO3lvdFtlIz3pwCH/v7OkqRhPjHv7Y8=; b=He5w4tm1nhOAJD/jdMINI8XoJqpRTOyTpbEPYR23wLwjktZN16KOpbTJWKIZaAmmDdFQhviiIM/vVpD7SEcmfpCnBWnKIRvFA78Pw7M1Byop7R6LdDupZV8FlAMH+wTzH/ntuLj6Y1fQCvtPl3hf+kCnT9Flk6oIr1vhZjD9MpsgzC5tTVt5lfWG7kRgEFUEqycdKCRi5loIvEFFCVh5OMnS764MDyhJajLqraqoFRScY1IBIISrwR9wDInTdA+bi4ItNwSZOArnuwjCSH1rrf0fVgeEXJ18bg39KbPZQUp5M9MszRYzgj9kHnhXOT2SGM80ybIPE9cV2AgD2kQung==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Myb2qmP25wl19U2ZSkbUtuw7+WFycIiDjYNspu8R7p7SMMc44LqHzERGeUKCWjr+8FJrT13FHZdMyXEOXM0Zawt7z2hkdsNCjTKeD+vTGwBh0FY/tHnkgrZMnYFGLLniGikbUji+S/7YoK+TtvFm5BD0y4zuJh72Vor697KTZrsfzhRcRnvrgeI7ZYWBvmXBKb9lwFkldyV7fVsc15Vl9d3cC4UretL2I18LuLaOXVd0hdJmyfS5q29VWRXolJcSHtSKUJV6Td7uaATT4ZALnH7cnRcJZ0VQmMEnDIQZoGzvlYp2z+RncUpQs89Sf3bEU2NcFDsR4nCLtKpeH3dQbg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: julien@xxxxxxx, sstabellini@xxxxxxxxxx, oleksandr_tyshchenko@xxxxxxxx, volodymyr_babchuk@xxxxxxxx, artem_mygaiev@xxxxxxxx, roger.pau@xxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, paul@xxxxxxx, bertrand.marquis@xxxxxxx, rahul.singh@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Fri, 04 Feb 2022 14:30:34 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 04.02.2022 07:34, Oleksandr Andrushchenko wrote:
> Reset the command register when assigning a PCI device to a guest:
> according to the PCI spec the PCI_COMMAND register is typically all 0's
> after reset.
It's not entirely clear to me whether setting the hardware register to
zero is okay. What wants to be zero is the value the guest observes
initially.
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -454,8 +454,7 @@ static void cmd_write(const struct pci_dev *pdev,
> unsigned int reg,
> pci_conf_write16(pdev->sbdf, reg, cmd);
> }
>
> -static void guest_cmd_write(const struct pci_dev *pdev, unsigned int reg,
> - uint32_t cmd, void *data)
> +static uint32_t emulate_cmd_reg(const struct pci_dev *pdev, uint32_t cmd)
The command register is a 16-bit one, so parameter and return type should
either be plain unsigned int (preferred, see ./CODING_STYLE) or uint16_t
imo.
Jan
|