platform_drv: don't copy Bdf

genodelabs/genode#5002
This commit is contained in:
Johannes Schlatow 2023-11-23 11:40:58 +01:00
parent 3f1e1323f0
commit 1f1437747c
9 changed files with 23 additions and 22 deletions

View File

@ -114,7 +114,7 @@ void Device_pd::remove_range(Io_mmu::Range const & range)
void Device_pd::enable_pci_device(Io_mem_dataspace_capability const io_mem_cap,
Pci::Bdf const bdf)
Pci::Bdf const & bdf)
{
addr_t addr = _address_space.attach(io_mem_cap, 0x1000);
@ -134,7 +134,7 @@ void Device_pd::enable_pci_device(Io_mem_dataspace_capability const io_mem_cap,
}
void Device_pd::disable_pci_device(Pci::Bdf const)
void Device_pd::disable_pci_device(Pci::Bdf const &)
{
warning("Cannot unassign PCI device from device PD (not implemented by kernel).");
}

View File

@ -93,8 +93,8 @@ class Driver::Device_pd : public Io_mmu::Domain
void remove_range(Io_mmu::Range const &) override;
void enable_pci_device(Io_mem_dataspace_capability const,
Pci::Bdf const) override;
void disable_pci_device(Pci::Bdf const) override;
Pci::Bdf const &) override;
void disable_pci_device(Pci::Bdf const &) override;
};

View File

@ -79,8 +79,8 @@ class Driver::Io_mmu : private Io_mmu_devices::Element
/* interface for (un)assigning a pci device */
virtual void enable_pci_device(Io_mem_dataspace_capability const,
Pci::Bdf const) = 0;
virtual void disable_pci_device(Pci::Bdf const) = 0;
Pci::Bdf const &) = 0;
virtual void disable_pci_device(Pci::Bdf const &) = 0;
/* interface for adding/removing DMA buffers */
virtual void add_range(Range const &,
@ -138,7 +138,7 @@ class Driver::Io_mmu : private Io_mmu_devices::Element
virtual void add_default_range(Range const &, addr_t) { }
/* interface for activating default mappings for certain device */
virtual void enable_default_mappings(Pci::Bdf) { }
virtual void enable_default_mappings(Pci::Bdf const &) { }
/* interface for completing default mappings (enabled IOMMU) */
virtual void default_mappings_complete() { }

View File

@ -16,7 +16,7 @@
#include <intel/default_mappings.h>
void Intel::Default_mappings::_insert_context(Managed_root_table & root,
Pci::Bdf bdf,
Pci::Bdf const & bdf,
addr_t paddr,
Domain_id domain_id)
{
@ -60,14 +60,15 @@ void Intel::Default_mappings::insert_translation(addr_t va, addr_t pa,
}
void Intel::Default_mappings::enable_device(Pci::Bdf bdf, Domain_id domain_id)
void Intel::Default_mappings::enable_device(Pci::Bdf const & bdf,
Domain_id domain_id)
{
_insert_context(_root_table, bdf, _default_table_phys, domain_id);
}
void Intel::Default_mappings::copy_stage2(Managed_root_table & dst_root,
Pci::Bdf bdf)
Pci::Bdf const & bdf)
{
_root_table.with_stage2_pointer(bdf, [&] (addr_t phys_addr, Domain_id domain) {
_insert_context(dst_root, bdf, phys_addr, domain); });
@ -77,7 +78,7 @@ void Intel::Default_mappings::copy_stage2(Managed_root_table & dst_root,
void Intel::Default_mappings::copy_stage2(Managed_root_table & dst_root)
{
_root_table.for_each_stage2_pointer(
[&] (Pci::Bdf bdf, addr_t phys_addr, Domain_id domain) {
[&] (Pci::Bdf const & bdf, addr_t phys_addr, Domain_id domain) {
_insert_context(dst_root, bdf, phys_addr, domain); });
}

View File

@ -59,15 +59,15 @@ class Intel::Default_mappings
return 0;
}
void _insert_context(Managed_root_table &, Pci::Bdf, addr_t, Domain_id);
void _insert_context(Managed_root_table &, Pci::Bdf const &, addr_t, Domain_id);
public:
void insert_translation(addr_t, addr_t, size_t, Page_flags, uint32_t);
void enable_device(Pci::Bdf, Domain_id);
void enable_device(Pci::Bdf const &, Domain_id);
void copy_stage2(Managed_root_table &, Pci::Bdf);
void copy_stage2(Managed_root_table &, Pci::Bdf const &);
void copy_stage2(Managed_root_table &);
Default_mappings(Env & env,

View File

@ -52,7 +52,7 @@ void Intel::Io_mmu::Domain<TABLE>::enable_pci_device(Io_mem_dataspace_capability
template <typename TABLE>
void Intel::Io_mmu::Domain<TABLE>::disable_pci_device(Pci::Bdf const bdf)
void Intel::Io_mmu::Domain<TABLE>::disable_pci_device(Pci::Bdf const & bdf)
{
_intel_iommu.root_table().remove_context(bdf, _translation_table_phys);

View File

@ -545,10 +545,10 @@ class Intel::Io_mmu : private Attached_mmio,
*/
void add_default_range(Range const &, addr_t) override;
void default_mappings_complete() override;
void enable_default_mappings(Pci::Bdf bdf) override {
void enable_default_mappings(Pci::Bdf const & bdf) override {
_default_mappings.enable_device(bdf, _default_domain); }
void apply_default_mappings(Pci::Bdf bdf) {
void apply_default_mappings(Pci::Bdf const & bdf) {
_default_mappings.copy_stage2(_managed_root_table, bdf); }
/**

View File

@ -14,7 +14,7 @@
/* local includes */
#include <intel/managed_root_table.h>
void Intel::Managed_root_table::remove_context(Pci::Bdf bdf,
void Intel::Managed_root_table::remove_context(Pci::Bdf const & bdf,
addr_t phys_addr)
{
_with_context_table(bdf.bus, [&] (Context_table & ctx) {

View File

@ -100,7 +100,7 @@ class Intel::Managed_root_table : public Registered_translation_table
}
template <typename FN>
void with_stage2_pointer(Pci::Bdf bdf, FN && fn)
void with_stage2_pointer(Pci::Bdf const & bdf, FN && fn)
{
_with_context_table(bdf.bus, [&] (Context_table & ctx) {
Pci::rid_t rid = Pci::Bdf::rid(bdf);
@ -112,7 +112,7 @@ class Intel::Managed_root_table : public Registered_translation_table
/* add second-stage table */
template <unsigned ADDRESS_WIDTH>
Domain_id insert_context(Pci::Bdf bdf, addr_t phys_addr, Domain_id domain)
Domain_id insert_context(Pci::Bdf const & bdf, addr_t phys_addr, Domain_id domain)
{
Domain_id cur_domain { };
@ -129,7 +129,7 @@ class Intel::Managed_root_table : public Registered_translation_table
}
/* remove second-stage table for particular device */
void remove_context(Pci::Bdf, addr_t);
void remove_context(Pci::Bdf const &, addr_t);
/* remove second-stage table for all devices */
void remove_context(addr_t);