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