NOVA User-Level Environment  Version testbox/changed-memory-timing-317-g320d8b5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DirectPciDevice Class Reference

Directly assign a host PCI device to the guest. More...

Inheritance diagram for DirectPciDevice:
StaticReceiver< DirectPciDevice > HostVfPci Device HostPci

Classes

struct  MsiXTableEntry

Public Member Functions

void read_all_bars (unsigned bdf, unsigned long *base, unsigned long *size)
void read_all_vf_bars (unsigned bdf, unsigned vf_no, unsigned long *base, unsigned long *size)
 Read all vf bars.
bool receive (MessageIOIn &msg)
bool receive (MessageIOOut &msg)
bool receive (MessagePciConfig &msg)
bool receive (MessageIrq &msg)
bool receive (MessageIrqNotify &msg)
bool receive (MessageMem &msg)
bool receive (MessageMemRegion &msg)
bool receive (MessageLegacy &msg)
 DirectPciDevice (Motherboard &mb, unsigned hbdf, unsigned guestbdf, bool assign, bool use_irqs=true, unsigned parent_bdf=0, unsigned vf_no=0, bool map=true)
- Public Member Functions inherited from StaticReceiver< DirectPciDevice >
 StaticReceiver ()
- Public Member Functions inherited from Device
void debug_dump ()
 Device (const char *debug_name)
- Public Member Functions inherited from HostVfPci
unsigned long long vf_bar_base_size (unsigned bdf, unsigned vf_no, unsigned no, unsigned long long &size, bool *is64bit=0)
 Return the base and size of a VF BAR (inside a SR-IOV capability).
unsigned vf_bdf (unsigned parent_bdf, unsigned vf_no)
 Compute BDF of a particular VF.
unsigned vf_device_id (unsigned parent_bdf)
 HostVfPci (DBus< MessageHwPciConfig > &bus_pcicfg, DBus< MessageHostOp > &bus_hostop)
- Public Member Functions inherited from HostPci
unsigned conf_read (unsigned bdf, unsigned dword)
void conf_write (unsigned bdf, unsigned dword, unsigned value)
unsigned count_bars (unsigned bdf)
 Induce the number of the bars from the header-type.
unsigned search_device (unsigned theclass, unsigned subclass, unsigned instance)
 Searches for a given device and returns the bdf of it.
unsigned search_bridge (unsigned dst)
 Scan the PCI root bus for bridges.
unsigned get_gsi_msi (DBus< MessageHostOp > &bus_hostop, unsigned bdf, unsigned nr, void *msix_table=0)
 Program the nr-th MSI/MSI-X vector of the given device.
unsigned get_gsi (DBus< MessageHostOp > &bus_hostop, DBus< MessageAcpi > &bus_acpi, unsigned bdf, unsigned nr, bool level=false, void *msix_table=0)
 Returns the gsi and enables them.
unsigned find_cap (unsigned bdf, unsigned char id)
 Find the position of a legacy PCI capability.
unsigned find_extended_cap (unsigned bdf, unsigned short id)
 Find the position of an extended PCI capability.
unsigned long long bar_base (unsigned bdf, unsigned bar, unsigned *type=0)
 Get the base and the type of a bar.
unsigned long long bar_size (unsigned bdf, unsigned bar, bool *is64bit=0)
 Determines BAR size.
 HostPci (DBus< MessageHwPciConfig > &bus_pcicfg, DBus< MessageHostOp > &bus_hostop)

Private Types

enum  { PCI_CFG_SPACE_DWORDS = 1024 }

Private Member Functions

void map_bars (unsigned long *bases, unsigned long *sizes)
 Map the bars.
bool match_iobars (unsigned short port, unsigned short &newport, unsigned size)
unsigned match_bars (unsigned long address, unsigned size, unsigned *&ptr)
 Check whether the guest mem address matches and translate to host pointer address.

Private Attributes

Motherboard_mb
unsigned _hostbdf
unsigned _guestbdf
unsigned _irq_count
unsigned * _host_irqs
MsiXTableEntry_msix_table
MsiXTableEntry_msix_host_table
unsigned _cfgspace [PCI_CFG_SPACE_DWORDS]
unsigned _bar_count
unsigned _msi_cap
bool _msi_64bit
unsigned _msix_cap
unsigned _msix_bar
struct {
   unsigned long   size
   char *   ptr
   bool   io
   unsigned short   port
_barinfo [MAX_BAR]
bool _vf

Additional Inherited Members

- Public Types inherited from HostVfPci
enum  { SRIOV_VF_BAR0 = 9, EXTCAP_ARI = 0x000EU, EXTCAP_SRIOV = 0x0010U }
- Static Public Member Functions inherited from StaticReceiver< DirectPciDevice >
static bool receive_static (Device *o, M &msg)

Detailed Description

Directly assign a host PCI device to the guest.

State: testing Features: pcicfgspace, ioport operations, memory read/write, host irq, mem-alloc, DMA remapping Missing: MSI, MSI-X Documentation: PCI spec v.2.2

Member Enumeration Documentation

anonymous enum
private
Enumerator:
PCI_CFG_SPACE_DWORDS 

Constructor & Destructor Documentation

DirectPciDevice::DirectPciDevice ( Motherboard mb,
unsigned  hbdf,
unsigned  guestbdf,
bool  assign,
bool  use_irqs = true,
unsigned  parent_bdf = 0,
unsigned  vf_no = 0,
bool  map = true 
)
inline

Member Function Documentation

void DirectPciDevice::map_bars ( unsigned long *  bases,
unsigned long *  sizes 
)
inlineprivate

Map the bars.

unsigned DirectPciDevice::match_bars ( unsigned long  address,
unsigned  size,
unsigned *&  ptr 
)
inlineprivate

Check whether the guest mem address matches and translate to host pointer address.

bool DirectPciDevice::match_iobars ( unsigned short  port,
unsigned short &  newport,
unsigned  size 
)
inlineprivate
void DirectPciDevice::read_all_bars ( unsigned  bdf,
unsigned long *  base,
unsigned long *  size 
)
inline
void DirectPciDevice::read_all_vf_bars ( unsigned  bdf,
unsigned  vf_no,
unsigned long *  base,
unsigned long *  size 
)
inline

Read all vf bars.

bool DirectPciDevice::receive ( MessageIOIn msg)
inline
bool DirectPciDevice::receive ( MessageIOOut msg)
inline
bool DirectPciDevice::receive ( MessagePciConfig msg)
inline
bool DirectPciDevice::receive ( MessageIrq msg)
inline
bool DirectPciDevice::receive ( MessageIrqNotify msg)
inline
bool DirectPciDevice::receive ( MessageMem msg)
inline
bool DirectPciDevice::receive ( MessageMemRegion msg)
inline
bool DirectPciDevice::receive ( MessageLegacy msg)
inline

Disable Busmaster DMA on reset. Thus the device can not do DMA anymore.

XXX OSes are buggy and enable this bit to early, thus we have to reset the PCI device here!

Member Data Documentation

unsigned DirectPciDevice::_bar_count
private
struct { ... } DirectPciDevice::_barinfo[MAX_BAR]
unsigned DirectPciDevice::_cfgspace[PCI_CFG_SPACE_DWORDS]
private
unsigned DirectPciDevice::_guestbdf
private
unsigned* DirectPciDevice::_host_irqs
private
unsigned DirectPciDevice::_hostbdf
private
unsigned DirectPciDevice::_irq_count
private
Motherboard& DirectPciDevice::_mb
private
bool DirectPciDevice::_msi_64bit
private
unsigned DirectPciDevice::_msi_cap
private
unsigned DirectPciDevice::_msix_bar
private
unsigned DirectPciDevice::_msix_cap
private
MsiXTableEntry* DirectPciDevice::_msix_host_table
private
MsiXTableEntry* DirectPciDevice::_msix_table
private
bool DirectPciDevice::_vf
private
bool DirectPciDevice::io
unsigned short DirectPciDevice::port
char* DirectPciDevice::ptr
unsigned long DirectPciDevice::size

The documentation for this class was generated from the following file: