On 21.12.2023 14:29, Juergen Gross wrote:
> On 21.12.23 13:40, Jan Beulich wrote:
>> On 20.12.2023 17:34, Sébastien Chaumat wrote:
>>> Here are the patches I made to xen and linux kernel
>>> Plus dmesg (bare metal,xen) and "xl dmesg"
>>
>> So the problem looks to be that pci_xen_initial_domain() results in
>> permanent setup of IRQ7, when there only "static" ACPI tables (in
>> particular source overrides in MADT) are consulted. The necessary
>> settings, however, are known only after _CRS for the device was
>> evaluated (and possibly _PRS followed by invocation of _SRS). All of
>> this happens before xen_register_gsi() is called. But that function's
>> call to xen_register_pirq() is short-circuited by the very first if()
>> in xen_register_pirq() when there was an earlier invocation. Hence
>> the (wrong) "edge" binding remains in place, as was established by
>> the earlier call here.
>>
>> Jürgen, there's an interesting comment in xen_bind_pirq_gsi_to_irq(),
>> right before invoking irq_set_chip_and_handler_name(). Despite what
>> the comment says (according to my reading), the fasteoi one is _not_
>> used in all cases. Assuming there's a reason for this, it's not clear
>> to me whether updating the handler later on is a valid thing to do.
>> __irq_set_handler() being even an exported symbol suggests that might
>> be an option to use here. Then again merely updating the handler may
>> not be sufficient, seeing there are also e.g. IRQD_TRIGGER_MASK and
>> IRQD_LEVEL.
> 
> I understand the last paragraph of that comment to reason, that in case
> pirq_needs_eoi() return true even in case of an edge triggered interrupt,
> the outcome is still okay.
> 
> I don't think updating the handler later is valid.

In which case fixing this is going to be interesting.

>> Jürgen, looking at pci_xen_initial_domain(), what's the purpose of
>> the loop in the final if()? Can this ever do anything useful when
>> the earlier comment suggests nr_legacy_irqs() is zero anyway? Or is
>> the comment simply inaccurate in not covering the "no IO-APICs" case?
> 
> No, I think the final loop would only do something in case probe_8259A()
> is detecting a working PIC (which should not be the case IMHO). Could it
> be that there have been Xen versions emulating a PIC?

Not as far back as I can recall (for PV Dom0). Even in 3.2 Dom0 was
already denied access to the respective I/O ports. And iirc upstream
Linux wants at least 4.0?

Jan

Reply via email to