Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
4c47f800
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4c47f800
编写于
8月 30, 2012
作者:
G
Gerd Hoffmann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xhci: add msix support
Signed-off-by:
N
Gerd Hoffmann
<
kraxel@redhat.com
>
上级
4c4abe7c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
1 deletion
+49
-1
hw/usb/hcd-xhci.c
hw/usb/hcd-xhci.c
+46
-1
trace-events
trace-events
+3
-0
未找到文件。
hw/usb/hcd-xhci.c
浏览文件 @
4c47f800
...
...
@@ -23,6 +23,7 @@
#include "hw/usb.h"
#include "hw/pci.h"
#include "hw/msi.h"
#include "hw/msix.h"
#include "trace.h"
//#define DEBUG_XHCI
...
...
@@ -59,6 +60,8 @@
#define OFF_OPER LEN_CAP
#define OFF_RUNTIME 0x1000
#define OFF_DOORBELL 0x2000
#define OFF_MSIX_TABLE 0x3000
#define OFF_MSIX_PBA 0x3800
/* must be power of 2 */
#define LEN_REGS 0x4000
...
...
@@ -411,6 +414,7 @@ struct XHCIState {
uint32_t
erstba_high
;
uint32_t
erdp_low
;
uint32_t
erdp_high
;
bool
msix_used
;
int64_t
mfindex_start
;
QEMUTimer
*
mfwrap_timer
;
...
...
@@ -437,6 +441,7 @@ typedef struct XHCIEvRingSeg {
enum
xhci_flags
{
XHCI_FLAG_USE_MSI
=
1
,
XHCI_FLAG_USE_MSI_X
,
};
static
void
xhci_kick_ep
(
XHCIState
*
xhci
,
unsigned
int
slotid
,
...
...
@@ -616,7 +621,8 @@ static void xhci_intx_update(XHCIState *xhci)
{
int
level
=
0
;
if
(
msi_enabled
(
&
xhci
->
pci_dev
))
{
if
(
msix_enabled
(
&
xhci
->
pci_dev
)
||
msi_enabled
(
&
xhci
->
pci_dev
))
{
return
;
}
...
...
@@ -630,6 +636,30 @@ static void xhci_intx_update(XHCIState *xhci)
qemu_set_irq
(
xhci
->
irq
,
level
);
}
static
void
xhci_msix_update
(
XHCIState
*
xhci
)
{
bool
enabled
;
if
(
!
msix_enabled
(
&
xhci
->
pci_dev
))
{
return
;
}
enabled
=
xhci
->
iman
&
IMAN_IE
;
if
(
enabled
==
xhci
->
msix_used
)
{
return
;
}
if
(
enabled
)
{
trace_usb_xhci_irq_msix_use
(
0
);
msix_vector_use
(
&
xhci
->
pci_dev
,
0
);
xhci
->
msix_used
=
true
;
}
else
{
trace_usb_xhci_irq_msix_unuse
(
0
);
msix_vector_unuse
(
&
xhci
->
pci_dev
,
0
);
xhci
->
msix_used
=
false
;
}
}
static
void
xhci_intr_raise
(
XHCIState
*
xhci
)
{
if
(
!
(
xhci
->
iman
&
IMAN_IP
)
||
...
...
@@ -641,6 +671,12 @@ static void xhci_intr_raise(XHCIState *xhci)
return
;
}
if
(
msix_enabled
(
&
xhci
->
pci_dev
))
{
trace_usb_xhci_irq_msix
(
0
);
msix_notify
(
&
xhci
->
pci_dev
,
0
);
return
;
}
if
(
msi_enabled
(
&
xhci
->
pci_dev
))
{
trace_usb_xhci_irq_msi
(
0
);
msi_notify
(
&
xhci
->
pci_dev
,
0
);
...
...
@@ -2282,6 +2318,7 @@ static void xhci_reset(DeviceState *dev)
xhci
->
erstba_high
=
0
;
xhci
->
erdp_low
=
0
;
xhci
->
erdp_high
=
0
;
xhci
->
msix_used
=
0
;
xhci
->
er_ep_idx
=
0
;
xhci
->
er_pcs
=
1
;
...
...
@@ -2590,6 +2627,7 @@ static void xhci_runtime_write(XHCIState *xhci, uint32_t reg, uint32_t val)
xhci
->
iman
&=
~
IMAN_IE
;
xhci
->
iman
|=
val
&
IMAN_IE
;
xhci_intx_update
(
xhci
);
xhci_msix_update
(
xhci
);
break
;
case
0x24
:
/* IMOD */
xhci
->
imod
=
val
;
...
...
@@ -2883,6 +2921,12 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
if
(
xhci
->
flags
&
(
1
<<
XHCI_FLAG_USE_MSI
))
{
msi_init
(
&
xhci
->
pci_dev
,
0x70
,
MAXINTRS
,
true
,
false
);
}
if
(
xhci
->
flags
&
(
1
<<
XHCI_FLAG_USE_MSI_X
))
{
msix_init
(
&
xhci
->
pci_dev
,
MAXINTRS
,
&
xhci
->
mem
,
0
,
OFF_MSIX_TABLE
,
&
xhci
->
mem
,
0
,
OFF_MSIX_PBA
,
0x90
);
}
return
0
;
}
...
...
@@ -2894,6 +2938,7 @@ static const VMStateDescription vmstate_xhci = {
static
Property
xhci_properties
[]
=
{
DEFINE_PROP_BIT
(
"msi"
,
XHCIState
,
flags
,
XHCI_FLAG_USE_MSI
,
true
),
DEFINE_PROP_BIT
(
"msix"
,
XHCIState
,
flags
,
XHCI_FLAG_USE_MSI_X
,
true
),
DEFINE_PROP_UINT32
(
"p2"
,
XHCIState
,
numports_2
,
4
),
DEFINE_PROP_UINT32
(
"p3"
,
XHCIState
,
numports_3
,
4
),
DEFINE_PROP_END_OF_LIST
(),
...
...
trace-events
浏览文件 @
4c47f800
...
...
@@ -313,6 +313,9 @@ usb_xhci_runtime_write(uint32_t off, uint32_t val) "off 0x%04x, val 0x%08x"
usb_xhci_doorbell_write(uint32_t off, uint32_t val) "off 0x%04x, val 0x%08x"
usb_xhci_irq_intx(uint32_t level) "level %d"
usb_xhci_irq_msi(uint32_t nr) "nr %d"
usb_xhci_irq_msix(uint32_t nr) "nr %d"
usb_xhci_irq_msix_use(uint32_t nr) "nr %d"
usb_xhci_irq_msix_unuse(uint32_t nr) "nr %d"
usb_xhci_queue_event(uint32_t idx, const char *trb, const char *evt, uint64_t param, uint32_t status, uint32_t control) "idx %d, %s, %s, p %016" PRIx64 ", s %08x, c 0x%08x"
usb_xhci_fetch_trb(uint64_t addr, const char *name, uint64_t param, uint32_t status, uint32_t control) "addr %016" PRIx64 ", %s, p %016" PRIx64 ", s %08x, c 0x%08x"
usb_xhci_slot_enable(uint32_t slotid) "slotid %d"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录