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

Re: [Xen-devel] [PATCH v3 4/4] x86/apic: allow enabling x2APIC mode regardless of interrupt remapping


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 9 Dec 2019 11:56:10 +0100
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@xxxxxxxxxx; spf=Pass smtp.mailfrom=roger.pau@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Wei Liu <wl@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Mon, 09 Dec 2019 10:56:23 +0000
  • Ironport-sdr: T25yrwncxN7xWxWxE98bnYMr+KgPBjqxdLHkrXS+dcBBijkSMK9w1qUuPsxnSlEiFeqJQsHF6l 4VfAZxVB1J7ewzGoBeOG5qhvf459G/92HblO/mXAZ/UmtW+P54sS/517dJjAtpVK87ljXka2yA X4Ia9aNxtvtWHBFoB7wDk69066zcG7ZFl0jdZHVl8u461Bo41nkyT/XyxbvcsubcNs7j/GVskB 96Ohw3qME1YdGzRmLR1Wtp4e0mHzi9BpZ4UEKlVCIuWtAgshGVP63xzi5zUs7BGxXtmdK8ChqB 7pA=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Dec 05, 2019 at 10:45:59AM +0100, Jan Beulich wrote:
> On 04.12.2019 17:20, Roger Pau Monne wrote:
> > +        switch ( iommu_enable_x2apic() )
> >          {
> > +        case 0:
> > +            iommu_x2apic_enabled = true;
> > +            break;
> > +
> > +        case -ENXIO: /* ACPI_DMAR_X2APIC_OPT_OUT set */
> > +            if ( x2apic_enabled )
> > +                panic("IOMMU requests xAPIC mode, but x2APIC already 
> > enabled by firmware\n");
> > +
> >              printk("Not enabling x2APIC (upon firmware request)\n");
> > -            intremap_enabled = false;
> > +            iommu_x2apic_enabled = false;
> >              goto restore_out;
> > +
> > +        default:
> > +            printk(XENLOG_ERR "Failed to enable Interrupt Remapping\n");
> > +            iommu_x2apic_enabled = false;
> > +            break;
> 
> I guess you still need to panic() in the failure cases if x2apic_phys
> is false. Unless you can still properly switch from cluster to
> physical mode at this point in time. (If you go the panic() route,
> I'd appreciate if you could avoid making x2apic_phys non-static.)

I don't think Xen needs to check x2apic_phys or panic here, the x2apic
probe that selects phys or cluster mode is done afterwards in
apic_x2apic_probe, which is called after the attempt to enable
interrupt remapping and hence will take this result into account.

> > @@ -938,13 +931,16 @@ void __init x2apic_bsp_setup(void)
> >          printk("Switched to APIC driver %s\n", genapic.name);
> >  
> >  restore_out:
> > -    /*
> > -     * NB: do not use raw mode when restoring entries if the iommu has been
> > -     * enabled during the process, because the entries need to be 
> > translated
> > -     * and added to the remapping table in that case.
> > -     */
> > -    restore_IO_APIC_setup(ioapic_entries, !intremap_enabled);
> > -    unmask_8259A();
> > +    if ( iommu_supports_x2apic() )
> 
> Hmm, I first wanted to suggest to use iommu_x2apic_enabled here, but
> I realize the error cases above would then be wrong. Perhaps better
> to leave a brief comment to this effect?

Ack, would you be fine with:

"Note that iommu_x2apic_enabled cannot be used here because if the
IOMMU supports x2APIC but enabling failed Xen wouldn't restore the
IO-APIC and the 8259A state correctly."

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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