[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] vpci: Add resizable bar support
On Wed, Nov 13, 2024 at 04:00:27PM +0800, Jiqian Chen wrote: > +static void cf_check rebar_ctrl_write(const struct pci_dev *pdev, > + unsigned int reg, > + uint32_t val, > + void *data) > +{ > + uint32_t ctrl, index; > + struct vpci_bar *bars = pdev->vpci->header.bars; > + > + ctrl = pci_conf_read32(pdev->sbdf, reg); > + if ( ctrl == val ) > + return; > + > + ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE; > + if ( ctrl != ( val & ~PCI_REBAR_CTRL_BAR_SIZE ) ) > + return; > + > + index = ctrl & PCI_REBAR_CTRL_BAR_IDX; > + bars[index].size = (1 << ((val & PCI_REBAR_CTRL_BAR_SIZE) >> > + PCI_REBAR_CTRL_BAR_SHIFT)) * > + PCI_REBAR_CTRL_BAR_UNIT; One further comment: you also need to reset addr and guest_addr here (possibly by reading them from the BAR register), as the specification states that: "After writing the BAR Size field, the contents of the corresponding BAR are undefined" Hence the cached addr and guest_addr are stale after a write to the control register. Thanks, Roger.
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |