On 04.02.22 16:30, Jan Beulich wrote: > 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. "the PCI spec says the PCI_COMMAND register is typically all 0's after reset." Why wouldn't it be ok? What is the exact concern here? >> --- 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. God catch, thank you > Jan > Thank you, Oleksandr
- Re: [PATCH v6 01/13] xen/pci... Julien Grall
- Re: [PATCH v6 01/13] xen... Oleksandr Andrushchenko
- Re: [PATCH v6 01/13] xen... Julien Grall
- Re: [PATCH v6 01/13] xen... Oleksandr Andrushchenko
- [PATCH v6 08/13] vpci/header: program p2m with gue... Oleksandr Andrushchenko
- [PATCH v6 06/13] vpci/header: implement guest BAR ... Oleksandr Andrushchenko
- [PATCH v6 09/13] vpci/header: emulate PCI_COMMAND ... Oleksandr Andrushchenko
- Re: [PATCH v6 09/13] vpci/header: emulate PCI... Jan Beulich
- [PATCH v6 10/13] vpci/header: reset the command re... Oleksandr Andrushchenko
- Re: [PATCH v6 10/13] vpci/header: reset the c... Jan Beulich
- Re: [PATCH v6 10/13] vpci/header: reset t... Oleksandr Andrushchenko
- Re: [PATCH v6 10/13] vpci/header: res... Jan Beulich
- Re: [PATCH v6 10/13] vpci/header:... Oleksandr Andrushchenko
- Re: [PATCH v6 10/13] vpci/he... Jan Beulich
- Re: [PATCH v6 10/13] vpc... Oleksandr Andrushchenko
- Re: [PATCH v6 10/13] vpc... Jan Beulich
- Re: [PATCH v6 10/13] vpc... Oleksandr Andrushchenko
- Re: [PATCH v6 10/13] vpc... Jan Beulich
- Re: [PATCH v6 10/13] vpc... Oleksandr Andrushchenko
- Re: [PATCH v6 10/13] vpc... Jan Beulich
- Re: [PATCH v6 10/13] vpc... Oleksandr Andrushchenko