base: add irq_type session argument

By adding the `irq_type` argument, one can explicitly specify whether to
use LEGACY, MSI or MSI-X interrupts. We formerly used the
`device_phys_config` to implicitly select MSI, however, with the
addition of IOMMU support to the platform driver there is at least one
instance where we need an MSI for a non-PCI device.

Yet, by adding another session argument to the Irq session, we exceed
the character limit for session args. Since not all arguments are
relevant for LEGACY interrupts resp. MSI, we can split the Irq_connection
constructor to handle the two cases separately and omit unneeded
arguments.

genodelabs/genode#5002
This commit is contained in:
Johannes Schlatow
2023-10-03 15:37:01 +02:00
parent a80464299a
commit eefaa07024
16 changed files with 88 additions and 42 deletions

View File

@ -29,6 +29,7 @@ class Core::Irq_args
Irq_session::Trigger _irq_trigger { Irq_session::TRIGGER_UNCHANGED };
Irq_session::Polarity _irq_polarity { Irq_session::POLARITY_UNCHANGED };
Irq_session::Type _irq_type { Irq_session::TYPE_LEGACY };
long const _irq_number;
@ -38,8 +39,9 @@ class Core::Irq_args
:
_irq_number(Arg_string::find_arg(args, "irq_number").long_value(-1))
{
long irq_trg = Arg_string::find_arg(args, "irq_trigger").long_value(-1);
long irq_pol = Arg_string::find_arg(args, "irq_polarity").long_value(-1);
long irq_trg = Arg_string::find_arg(args, "irq_trigger").long_value(-1);
long irq_pol = Arg_string::find_arg(args, "irq_polarity").long_value(-1);
long irq_type = Arg_string::find_arg(args, "irq_type").long_value(-1);
switch (irq_trg) {
case -1:
@ -74,11 +76,29 @@ class Core::Irq_args
_irq_number);
throw Service_denied();
}
switch (irq_type) {
case -1:
case Irq_session::TYPE_LEGACY:
_irq_type = Irq_session::TYPE_LEGACY;
break;
case Irq_session::TYPE_MSI:
_irq_type = Irq_session::TYPE_MSI;
break;
case Irq_session::TYPE_MSIX:
_irq_type = Irq_session::TYPE_MSIX;
break;
default:
error("invalid type ", irq_type, " specified for IRQ ",
_irq_number);
throw Service_denied();
}
}
long irq_number() const { return _irq_number; }
Irq_session::Trigger trigger() const { return _irq_trigger; }
Irq_session::Polarity polarity() const { return _irq_polarity; }
Irq_session::Type type() const { return _irq_type; }
};
#endif /* _CORE__INCLUDE__IRQ_ARGS_H_ */