Tuesday June 14, 2005 | Anish's Weblog Anish's Weblog |
|
Hardware interrupts overview for Solaris X86 Welcome to OpenSolaris, and the wonders of Solaris 10. This paper provides a brief introduction to hardware interrupts on x86 platforms. It is relevant for Intel and AMD based platforms. Interrupt handling is done via interrupt controller hardware in the system which are mostly sideband signals. Inband interrupts, for e.g. Message Signalled Interrupts (MSIs), introduced with PCI v2.2 specification onwards, will be discussed in another blog. MSIs are becoming mainstay with advent of new interrconnects like PCI-Express. However, there are mainly two kinds of hardware interrupt controllers which are commonly used on x86 platforms: 1. 82c59(A) PIC(Programmable Interrupt Controller)
This is supported by the Solaris uppc(7d) module and its source is located at usr/src/uts/i86pc/io/psm/uppc.c. Each PIC can handle 8 vectored priority interrupting sources and there are two PICs cascaded together to provide 16 interrupts on x86 systems. However, one of the pin - IRQ2 of the 1st PIC is used to cascade the 2nd PIC and so there are only 15 interrupt sources. This can not be used for multiprocessor (MP) systems without any major modifications. 2. APIC (Advanced Programmable Interrupt controller)This is supported by the Solaris pcplusmp(7d) module and its source is located at usr/src/uts/i86pc/io/pcplusmp/apic.c. It consists of two components - I/O APIC and Local APIC. The Local APIC is embedded in the CPU while the I/O APIC is used for connecting the interrupting sources. The Local APIC also has the capability to send interprocessor interrupt from one cpu to another and so APIC is widely used on all the x86 MP systems. Each system can have multiple I/O APICs and each I/O APIC can have 4, 16, 20 or 24 interrupt pins. Since the Local APIC is embedded in the CPU and the I/O APIC can handle more than 16 interrupt sources, even the single-CPU systems uses APIC as well instead of some other hardware. There are many systems, which have I/O APICs with 4 inputs(this is typically done for PCI-X slotted systems, where each slot is given a dedicated I/O APIC, enabling INTA-INTD for each of the slots to have a dedicated input). Solaris supports multiple I/O APICs. processor #1 processor #2 Solaris x86 interrupt handling overviewWhen a device driver adding the interrupt through ddi_add_intr(9f),
it
eventually gets to uppc_addspl() in uppc(7d) for PIC or apic_addspl() in pcplusmp(7d) if using APIC. The interrupt pin will be identified and then enabled. It is quite simple for the uppc(7d) case, the interrupt pin to enable on the PICs is basically 1-1 mapped to the "IRQ#" or the
"interrupt" property of the device on Solaris. But for APIC (pcplusmp(7d)), it is a lot more complicated as internally it either
uses the MP Spec. 1.4[2] or ACPI specification[3] to locate the right interrupt pin of the right I/O APIC for the device. The system BIOS sets up how the interrupts are routed and saves that information in either the MP Specification table or somewhere that ACPI can easily access. pcplusmp(7d) then access that information to initialize and add the interrupts. For uppc(7d), vectors are set up such that the 1st pin or IRQ#0 is mapped to 32, IRQ1 to 33 and
so on. As for pcplusmp(7d), it is not as simple. Solaris handles interrupts based on interrupt priority and each device is assigned a unique priority (can be modified by the device driver). Say, if a device "abc" is assigned priority 5, then all other interrupts at 5 or lower can NOT be triggered when the interrupt handler of "abc" is executing. However, an interrupt of priority 6 or higher is allowed to trigger. Since APIC has mechanism to prioritize interrupts, pcplusmp(7d) needs to select the vectors accordingly. On the x86 platform, all the local variables of the interrupt handler are on stack. Also, if the interrupt handler needs to call another
function, the parameters that are passed to the function are on stack too. i.e. all the interrupt handlers should use the stack one way or
the other. Solaris code that handles interrupts
Below are few code snippets that deal with interrupts. To begin with the 256 vector entries are defined in the autovect[] table shown below: usr/src/uts/common/io/avintr.c
Reference:1.See Chapters 5 and 7 of the Intel Architecture Software Developer's Manual Volume 3: System Programmer Guide for details on how interrupts work on the x86 platform.2. Intel Multi-Processor Specification v1.4 3. Advanced Configuration & Power Interface (ACPI) specification home PS: Lots of thanks to Johnny Cheung, also in Solaris I/O, for originally contributing to this material. Technorati Tag: OpenSolaris Technorati Tag: Solaris Posted by anish ( Jun 14 2005, 10:23:20 AM PDT ) Permalink Comments [1] This provides a brief introduction to using InifniBand Device management with cfgadm(1m). Introduction
An InfiniBand (IB) device is enumerated by the IB nexus driver, ib(7D), based on the interfaces provided by IB Device M
anager (IBDM). The IB nexus driver creates and initializes five types of device
nodes: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Device Type |
Attachment Type format |
| Port Devices |
ib::PORT_GUID,0,service-name |
| HCA_SVC devices |
ib::HCA_GUID,0,servicename |
| VPPA devices |
ib::PORT_GUID,P_Key,service-name |
| IOC devices |
ib::IOC-GUID |
| Pseudo devices |
ib::driver_name,unit-address |
Static attachment |
Attachment type format |
| IB Fabric |
ib |
| Host Channel Adapter(s) |
hca:HCA-GUID |
# cfgadm -a ib hca:2C90109764440 Ap_Id Type Receptacle Occupant Condition hca:2C90109764440 IB-HCA connected configured ok ib IB-Fabric connected configured ok ib::2C90109764440,0,svch IB-HCA_SVC connected unconfigured unknown ib::2C90109764441,0,psvc IB-PORT connected unconfigured unknown ib::2C90109764441,ffff,ipib IB-VPPA connected unconfigured unknown ib::2C90109764442,0,psvc IB-PORT connected unconfigured unknown ib::2C90109764442,ffff,ipib IB-VPPA connected unconfigured unknown ib::daplt,0 IB-PSEUDO connected configured ok ib::rpcib,0 IB-PSEUDO connected configured ok #
# cfgadm -x list_clients hca:2C90109764440 Ap_Id IB Client Alternate HCA ib::daplt,0 daplt no ib::rpcib,0 nfs/ib no - ibmf no - ibdm no #
# cfgadm -a ib::daplt,0 Ap_Id Type Receptacle Occupant Condition ib::daplt,0 IB-PSEUDO connected unconfigured unknown # cfgadm -yc configure ib::daplt,0 # cfgadm -a ib::daplt,0 Ap_Id Type Receptacle Occupant Condition ib::daplt,0 IB-PSEUDO connected configured ok #Unconfiguring a device:
# cfgadm -a ib::daplt,0 Ap_Id Type Receptacle Occupant Condition ib::daplt,0 IB-PSEUDO connected configured ok # cfgadm -yc unconfigure ib::daplt,0 # cfgadm -a ib::daplt,0 Ap_Id Type Receptacle Occupant Condition ib::daplt,0 IB-PSEUDO connected unconfigured unknownThe example below shows how to unconfigure all kernel clients of a give InfiniBand Host Channel Adapter.
# cfgadm -x unconfig_clients hca:2C90109764440 Unconfigure Clients of HCA /devices/ib:2C90109764440 This operation will unconfigure IB clients of this HCA Continue (yes/no)? yes <<<<<<< #
# cfgadm -x list_services ib
PORT communication services:
psvc
VPPA communication services:
ipib
HCA communication services:
svch
# cfgadm -o comm=port,service=srp -x add_service ib
# cfgadm -x list_services ib
PORT communication services:
srp <<<<<<<<<<<<<<
psvc
VPPA communication services:
ipib
HCA communication services:
svch
#
Delete a communication service:
# cfgadm -x list_services ib
PORT communication services:
srp
psvc
VPPA communication services:
ipib
HCA communication services:
svch
# cfgadm -o comm=port,service=srp -x delete_service ib
# cfgadm -x list_services ib
PORT communication services:
psvc
VPPA communication services:
ipib
HCA communication services:
svch
#
Note that the examples are shown only for Port Devices but are applicable to all three device types.
port-list, port-entries, service-id, and service-name
| Archives | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Language | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Links | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Referrers | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Today's Page Hits: 20 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||