[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] vpci: Add resizable bar support



On Wed, Nov 20, 2024 at 02:30:33AM +0000, Chen, Jiqian wrote:
> On 2024/11/19 20:51, Roger Pau Monné wrote:
> > 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:
> How about just set them to 0, since the addr will be re-assigned by system 
> and the addr of BAR register is also out of date.

Seems good, I assume Xen would also get 0 as the BAR register address
after having changed the size.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.