Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
771df8cf
Commit
771df8cf
authored
Mar 24, 2020
by
Marc Zyngier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'irq/gic-v4.1' into irq/irqchip-next
Signed-off-by:
Marc Zyngier
<
maz@kernel.org
>
parents
00760d3c
009384b3
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
600 additions
and
55 deletions
+600
-55
drivers/irqchip/irq-gic-v3-its.c
drivers/irqchip/irq-gic-v3-its.c
+400
-22
drivers/irqchip/irq-gic-v3.c
drivers/irqchip/irq-gic-v3.c
+11
-2
drivers/irqchip/irq-gic-v4.c
drivers/irqchip/irq-gic-v4.c
+127
-7
include/kvm/arm_vgic.h
include/kvm/arm_vgic.h
+1
-0
include/linux/irqchip/arm-gic-common.h
include/linux/irqchip/arm-gic-common.h
+2
-0
include/linux/irqchip/arm-gic-v3.h
include/linux/irqchip/arm-gic-v3.h
+19
-1
include/linux/irqchip/arm-gic-v4.h
include/linux/irqchip/arm-gic-v4.h
+23
-2
virt/kvm/arm/vgic/vgic-v3.c
virt/kvm/arm/vgic/vgic-v3.c
+3
-1
virt/kvm/arm/vgic/vgic-v4.c
virt/kvm/arm/vgic/vgic-v4.c
+14
-20
No files found.
drivers/irqchip/irq-gic-v3-its.c
View file @
771df8cf
This diff is collapsed.
Click to expand it.
drivers/irqchip/irq-gic-v3.c
View file @
771df8cf
...
@@ -723,6 +723,7 @@ static void __init gic_dist_init(void)
...
@@ -723,6 +723,7 @@ static void __init gic_dist_init(void)
unsigned
int
i
;
unsigned
int
i
;
u64
affinity
;
u64
affinity
;
void
__iomem
*
base
=
gic_data
.
dist_base
;
void
__iomem
*
base
=
gic_data
.
dist_base
;
u32
val
;
/* Disable the distributor */
/* Disable the distributor */
writel_relaxed
(
0
,
base
+
GICD_CTLR
);
writel_relaxed
(
0
,
base
+
GICD_CTLR
);
...
@@ -755,9 +756,14 @@ static void __init gic_dist_init(void)
...
@@ -755,9 +756,14 @@ static void __init gic_dist_init(void)
/* Now do the common stuff, and wait for the distributor to drain */
/* Now do the common stuff, and wait for the distributor to drain */
gic_dist_config
(
base
,
GIC_LINE_NR
,
gic_dist_wait_for_rwp
);
gic_dist_config
(
base
,
GIC_LINE_NR
,
gic_dist_wait_for_rwp
);
val
=
GICD_CTLR_ARE_NS
|
GICD_CTLR_ENABLE_G1A
|
GICD_CTLR_ENABLE_G1
;
if
(
gic_data
.
rdists
.
gicd_typer2
&
GICD_TYPER2_nASSGIcap
)
{
pr_info
(
"Enabling SGIs without active state
\n
"
);
val
|=
GICD_CTLR_nASSGIreq
;
}
/* Enable distributor with ARE, Group1 */
/* Enable distributor with ARE, Group1 */
writel_relaxed
(
GICD_CTLR_ARE_NS
|
GICD_CTLR_ENABLE_G1A
|
GICD_CTLR_ENABLE_G1
,
writel_relaxed
(
val
,
base
+
GICD_CTLR
);
base
+
GICD_CTLR
);
/*
/*
* Set all global interrupts to the boot CPU only. ARE must be
* Set all global interrupts to the boot CPU only. ARE must be
...
@@ -828,6 +834,7 @@ static int __gic_populate_rdist(struct redist_region *region, void __iomem *ptr)
...
@@ -828,6 +834,7 @@ static int __gic_populate_rdist(struct redist_region *region, void __iomem *ptr)
typer
=
gic_read_typer
(
ptr
+
GICR_TYPER
);
typer
=
gic_read_typer
(
ptr
+
GICR_TYPER
);
if
((
typer
>>
32
)
==
aff
)
{
if
((
typer
>>
32
)
==
aff
)
{
u64
offset
=
ptr
-
region
->
redist_base
;
u64
offset
=
ptr
-
region
->
redist_base
;
raw_spin_lock_init
(
&
gic_data_rdist
()
->
rd_lock
);
gic_data_rdist_rd_base
()
=
ptr
;
gic_data_rdist_rd_base
()
=
ptr
;
gic_data_rdist
()
->
phys_base
=
region
->
phys_base
+
offset
;
gic_data_rdist
()
->
phys_base
=
region
->
phys_base
+
offset
;
...
@@ -1758,6 +1765,7 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
...
@@ -1758,6 +1765,7 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
gic_v3_kvm_info
.
vcpu
=
r
;
gic_v3_kvm_info
.
vcpu
=
r
;
gic_v3_kvm_info
.
has_v4
=
gic_data
.
rdists
.
has_vlpis
;
gic_v3_kvm_info
.
has_v4
=
gic_data
.
rdists
.
has_vlpis
;
gic_v3_kvm_info
.
has_v4_1
=
gic_data
.
rdists
.
has_rvpeid
;
gic_set_kvm_info
(
&
gic_v3_kvm_info
);
gic_set_kvm_info
(
&
gic_v3_kvm_info
);
}
}
...
@@ -2073,6 +2081,7 @@ static void __init gic_acpi_setup_kvm_info(void)
...
@@ -2073,6 +2081,7 @@ static void __init gic_acpi_setup_kvm_info(void)
}
}
gic_v3_kvm_info
.
has_v4
=
gic_data
.
rdists
.
has_vlpis
;
gic_v3_kvm_info
.
has_v4
=
gic_data
.
rdists
.
has_vlpis
;
gic_v3_kvm_info
.
has_v4_1
=
gic_data
.
rdists
.
has_rvpeid
;
gic_set_kvm_info
(
&
gic_v3_kvm_info
);
gic_set_kvm_info
(
&
gic_v3_kvm_info
);
}
}
...
...
drivers/irqchip/irq-gic-v4.c
View file @
771df8cf
...
@@ -85,6 +85,53 @@
...
@@ -85,6 +85,53 @@
static
struct
irq_domain
*
gic_domain
;
static
struct
irq_domain
*
gic_domain
;
static
const
struct
irq_domain_ops
*
vpe_domain_ops
;
static
const
struct
irq_domain_ops
*
vpe_domain_ops
;
static
const
struct
irq_domain_ops
*
sgi_domain_ops
;
static
bool
has_v4_1
(
void
)
{
return
!!
sgi_domain_ops
;
}
static
int
its_alloc_vcpu_sgis
(
struct
its_vpe
*
vpe
,
int
idx
)
{
char
*
name
;
int
sgi_base
;
if
(
!
has_v4_1
())
return
0
;
name
=
kasprintf
(
GFP_KERNEL
,
"GICv4-sgi-%d"
,
task_pid_nr
(
current
));
if
(
!
name
)
goto
err
;
vpe
->
fwnode
=
irq_domain_alloc_named_id_fwnode
(
name
,
idx
);
if
(
!
vpe
->
fwnode
)
goto
err
;
kfree
(
name
);
name
=
NULL
;
vpe
->
sgi_domain
=
irq_domain_create_linear
(
vpe
->
fwnode
,
16
,
sgi_domain_ops
,
vpe
);
if
(
!
vpe
->
sgi_domain
)
goto
err
;
sgi_base
=
__irq_domain_alloc_irqs
(
vpe
->
sgi_domain
,
-
1
,
16
,
NUMA_NO_NODE
,
vpe
,
false
,
NULL
);
if
(
sgi_base
<=
0
)
goto
err
;
return
0
;
err:
if
(
vpe
->
sgi_domain
)
irq_domain_remove
(
vpe
->
sgi_domain
);
if
(
vpe
->
fwnode
)
irq_domain_free_fwnode
(
vpe
->
fwnode
);
kfree
(
name
);
return
-
ENOMEM
;
}
int
its_alloc_vcpu_irqs
(
struct
its_vm
*
vm
)
int
its_alloc_vcpu_irqs
(
struct
its_vm
*
vm
)
{
{
...
@@ -112,8 +159,13 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
...
@@ -112,8 +159,13 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
if
(
vpe_base_irq
<=
0
)
if
(
vpe_base_irq
<=
0
)
goto
err
;
goto
err
;
for
(
i
=
0
;
i
<
vm
->
nr_vpes
;
i
++
)
for
(
i
=
0
;
i
<
vm
->
nr_vpes
;
i
++
)
{
int
ret
;
vm
->
vpes
[
i
]
->
irq
=
vpe_base_irq
+
i
;
vm
->
vpes
[
i
]
->
irq
=
vpe_base_irq
+
i
;
ret
=
its_alloc_vcpu_sgis
(
vm
->
vpes
[
i
],
i
);
if
(
ret
)
goto
err
;
}
return
0
;
return
0
;
...
@@ -126,8 +178,28 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
...
@@ -126,8 +178,28 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
static
void
its_free_sgi_irqs
(
struct
its_vm
*
vm
)
{
int
i
;
if
(
!
has_v4_1
())
return
;
for
(
i
=
0
;
i
<
vm
->
nr_vpes
;
i
++
)
{
unsigned
int
irq
=
irq_find_mapping
(
vm
->
vpes
[
i
]
->
sgi_domain
,
0
);
if
(
WARN_ON
(
!
irq
))
continue
;
irq_domain_free_irqs
(
irq
,
16
);
irq_domain_remove
(
vm
->
vpes
[
i
]
->
sgi_domain
);
irq_domain_free_fwnode
(
vm
->
vpes
[
i
]
->
fwnode
);
}
}
void
its_free_vcpu_irqs
(
struct
its_vm
*
vm
)
void
its_free_vcpu_irqs
(
struct
its_vm
*
vm
)
{
{
its_free_sgi_irqs
(
vm
);
irq_domain_free_irqs
(
vm
->
vpes
[
0
]
->
irq
,
vm
->
nr_vpes
);
irq_domain_free_irqs
(
vm
->
vpes
[
0
]
->
irq
,
vm
->
nr_vpes
);
irq_domain_remove
(
vm
->
domain
);
irq_domain_remove
(
vm
->
domain
);
irq_domain_free_fwnode
(
vm
->
fwnode
);
irq_domain_free_fwnode
(
vm
->
fwnode
);
...
@@ -138,18 +210,50 @@ static int its_send_vpe_cmd(struct its_vpe *vpe, struct its_cmd_info *info)
...
@@ -138,18 +210,50 @@ static int its_send_vpe_cmd(struct its_vpe *vpe, struct its_cmd_info *info)
return
irq_set_vcpu_affinity
(
vpe
->
irq
,
info
);
return
irq_set_vcpu_affinity
(
vpe
->
irq
,
info
);
}
}
int
its_schedule_vpe
(
struct
its_vpe
*
vpe
,
bool
on
)
int
its_make_vpe_non_resident
(
struct
its_vpe
*
vpe
,
bool
db
)
{
struct
irq_desc
*
desc
=
irq_to_desc
(
vpe
->
irq
);
struct
its_cmd_info
info
=
{
};
int
ret
;
WARN_ON
(
preemptible
());
info
.
cmd_type
=
DESCHEDULE_VPE
;
if
(
has_v4_1
())
{
/* GICv4.1 can directly deal with doorbells */
info
.
req_db
=
db
;
}
else
{
/* Undo the nested disable_irq() calls... */
while
(
db
&&
irqd_irq_disabled
(
&
desc
->
irq_data
))
enable_irq
(
vpe
->
irq
);
}
ret
=
its_send_vpe_cmd
(
vpe
,
&
info
);
if
(
!
ret
)
vpe
->
resident
=
false
;
return
ret
;
}
int
its_make_vpe_resident
(
struct
its_vpe
*
vpe
,
bool
g0en
,
bool
g1en
)
{
{
struct
its_cmd_info
info
;
struct
its_cmd_info
info
=
{
}
;
int
ret
;
int
ret
;
WARN_ON
(
preemptible
());
WARN_ON
(
preemptible
());
info
.
cmd_type
=
on
?
SCHEDULE_VPE
:
DESCHEDULE_VPE
;
info
.
cmd_type
=
SCHEDULE_VPE
;
if
(
has_v4_1
())
{
info
.
g0en
=
g0en
;
info
.
g1en
=
g1en
;
}
else
{
/* Disabled the doorbell, as we're about to enter the guest */
disable_irq_nosync
(
vpe
->
irq
);
}
ret
=
its_send_vpe_cmd
(
vpe
,
&
info
);
ret
=
its_send_vpe_cmd
(
vpe
,
&
info
);
if
(
!
ret
)
if
(
!
ret
)
vpe
->
resident
=
on
;
vpe
->
resident
=
true
;
return
ret
;
return
ret
;
}
}
...
@@ -216,12 +320,28 @@ int its_prop_update_vlpi(int irq, u8 config, bool inv)
...
@@ -216,12 +320,28 @@ int its_prop_update_vlpi(int irq, u8 config, bool inv)
return
irq_set_vcpu_affinity
(
irq
,
&
info
);
return
irq_set_vcpu_affinity
(
irq
,
&
info
);
}
}
int
its_init_v4
(
struct
irq_domain
*
domain
,
const
struct
irq_domain_ops
*
ops
)
int
its_prop_update_vsgi
(
int
irq
,
u8
priority
,
bool
group
)
{
struct
its_cmd_info
info
=
{
.
cmd_type
=
PROP_UPDATE_VSGI
,
{
.
priority
=
priority
,
.
group
=
group
,
},
};
return
irq_set_vcpu_affinity
(
irq
,
&
info
);
}
int
its_init_v4
(
struct
irq_domain
*
domain
,
const
struct
irq_domain_ops
*
vpe_ops
,
const
struct
irq_domain_ops
*
sgi_ops
)
{
{
if
(
domain
)
{
if
(
domain
)
{
pr_info
(
"ITS: Enabling GICv4 support
\n
"
);
pr_info
(
"ITS: Enabling GICv4 support
\n
"
);
gic_domain
=
domain
;
gic_domain
=
domain
;
vpe_domain_ops
=
ops
;
vpe_domain_ops
=
vpe_ops
;
sgi_domain_ops
=
sgi_ops
;
return
0
;
return
0
;
}
}
...
...
include/kvm/arm_vgic.h
View file @
771df8cf
...
@@ -70,6 +70,7 @@ struct vgic_global {
...
@@ -70,6 +70,7 @@ struct vgic_global {
/* Hardware has GICv4? */
/* Hardware has GICv4? */
bool
has_gicv4
;
bool
has_gicv4
;
bool
has_gicv4_1
;
/* GIC system register CPU interface */
/* GIC system register CPU interface */
struct
static_key_false
gicv3_cpuif
;
struct
static_key_false
gicv3_cpuif
;
...
...
include/linux/irqchip/arm-gic-common.h
View file @
771df8cf
...
@@ -32,6 +32,8 @@ struct gic_kvm_info {
...
@@ -32,6 +32,8 @@ struct gic_kvm_info {
struct
resource
vctrl
;
struct
resource
vctrl
;
/* vlpi support */
/* vlpi support */
bool
has_v4
;
bool
has_v4
;
/* rvpeid support */
bool
has_v4_1
;
};
};
const
struct
gic_kvm_info
*
gic_get_kvm_info
(
void
);
const
struct
gic_kvm_info
*
gic_get_kvm_info
(
void
);
...
...
include/linux/irqchip/arm-gic-v3.h
View file @
771df8cf
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
#define GICD_SPENDSGIR 0x0F20
#define GICD_SPENDSGIR 0x0F20
#define GICD_CTLR_RWP (1U << 31)
#define GICD_CTLR_RWP (1U << 31)
#define GICD_CTLR_nASSGIreq (1U << 8)
#define GICD_CTLR_DS (1U << 6)
#define GICD_CTLR_DS (1U << 6)
#define GICD_CTLR_ARE_NS (1U << 4)
#define GICD_CTLR_ARE_NS (1U << 4)
#define GICD_CTLR_ENABLE_G1A (1U << 1)
#define GICD_CTLR_ENABLE_G1A (1U << 1)
...
@@ -90,6 +91,7 @@
...
@@ -90,6 +91,7 @@
#define GICD_TYPER_ESPIS(typer) \
#define GICD_TYPER_ESPIS(typer) \
(((typer) & GICD_TYPER_ESPI) ? GICD_TYPER_SPIS((typer) >> 27) : 0)
(((typer) & GICD_TYPER_ESPI) ? GICD_TYPER_SPIS((typer) >> 27) : 0)
#define GICD_TYPER2_nASSGIcap (1U << 8)
#define GICD_TYPER2_VIL (1U << 7)
#define GICD_TYPER2_VIL (1U << 7)
#define GICD_TYPER2_VID GENMASK(4, 0)
#define GICD_TYPER2_VID GENMASK(4, 0)
...
@@ -346,6 +348,15 @@
...
@@ -346,6 +348,15 @@
#define GICR_VPENDBASER_4_1_VGRP1EN (1ULL << 58)
#define GICR_VPENDBASER_4_1_VGRP1EN (1ULL << 58)
#define GICR_VPENDBASER_4_1_VPEID GENMASK_ULL(15, 0)
#define GICR_VPENDBASER_4_1_VPEID GENMASK_ULL(15, 0)
#define GICR_VSGIR 0x0080
#define GICR_VSGIR_VPEID GENMASK(15, 0)
#define GICR_VSGIPENDR 0x0088
#define GICR_VSGIPENDR_BUSY (1U << 31)
#define GICR_VSGIPENDR_PENDING GENMASK(15, 0)
/*
/*
* ITS registers, offsets from ITS_base
* ITS registers, offsets from ITS_base
*/
*/
...
@@ -369,6 +380,11 @@
...
@@ -369,6 +380,11 @@
#define GITS_TRANSLATER 0x10040
#define GITS_TRANSLATER 0x10040
#define GITS_SGIR 0x20020
#define GITS_SGIR_VPEID GENMASK_ULL(47, 32)
#define GITS_SGIR_VINTID GENMASK_ULL(3, 0)
#define GITS_CTLR_ENABLE (1U << 0)
#define GITS_CTLR_ENABLE (1U << 0)
#define GITS_CTLR_ImDe (1U << 1)
#define GITS_CTLR_ImDe (1U << 1)
#define GITS_CTLR_ITS_NUMBER_SHIFT 4
#define GITS_CTLR_ITS_NUMBER_SHIFT 4
...
@@ -503,8 +519,9 @@
...
@@ -503,8 +519,9 @@
#define GITS_CMD_VMAPTI GITS_CMD_GICv4(GITS_CMD_MAPTI)
#define GITS_CMD_VMAPTI GITS_CMD_GICv4(GITS_CMD_MAPTI)
#define GITS_CMD_VMOVI GITS_CMD_GICv4(GITS_CMD_MOVI)
#define GITS_CMD_VMOVI GITS_CMD_GICv4(GITS_CMD_MOVI)
#define GITS_CMD_VSYNC GITS_CMD_GICv4(GITS_CMD_SYNC)
#define GITS_CMD_VSYNC GITS_CMD_GICv4(GITS_CMD_SYNC)
/* VMOVP and INVDB are the odd ones, as they dont have a physical counterpart */
/* VMOVP
, VSGI
and INVDB are the odd ones, as they dont have a physical counterpart */
#define GITS_CMD_VMOVP GITS_CMD_GICv4(2)
#define GITS_CMD_VMOVP GITS_CMD_GICv4(2)
#define GITS_CMD_VSGI GITS_CMD_GICv4(3)
#define GITS_CMD_INVDB GITS_CMD_GICv4(0xe)
#define GITS_CMD_INVDB GITS_CMD_GICv4(0xe)
/*
/*
...
@@ -653,6 +670,7 @@
...
@@ -653,6 +670,7 @@
struct
rdists
{
struct
rdists
{
struct
{
struct
{
raw_spinlock_t
rd_lock
;
void
__iomem
*
rd_base
;
void
__iomem
*
rd_base
;
struct
page
*
pend_page
;
struct
page
*
pend_page
;
phys_addr_t
phys_base
;
phys_addr_t
phys_base
;
...
...
include/linux/irqchip/arm-gic-v4.h
View file @
771df8cf
...
@@ -49,10 +49,22 @@ struct its_vpe {
...
@@ -49,10 +49,22 @@ struct its_vpe {
};
};
/* GICv4.1 implementations */
/* GICv4.1 implementations */
struct
{
struct
{
struct
fwnode_handle
*
fwnode
;
struct
irq_domain
*
sgi_domain
;
struct
{
u8
priority
;
bool
enabled
;
bool
group
;
}
sgi_config
[
16
];
atomic_t
vmapp_count
;
atomic_t
vmapp_count
;
};
};
};
};
/*
* Ensures mutual exclusion between affinity setting of the
* vPE and vLPI operations using vpe->col_idx.
*/
raw_spinlock_t
vpe_lock
;
/*
/*
* This collection ID is used to indirect the target
* This collection ID is used to indirect the target
* redistributor for this VPE. The ID itself isn't involved in
* redistributor for this VPE. The ID itself isn't involved in
...
@@ -93,6 +105,7 @@ enum its_vcpu_info_cmd_type {
...
@@ -93,6 +105,7 @@ enum its_vcpu_info_cmd_type {
SCHEDULE_VPE
,
SCHEDULE_VPE
,
DESCHEDULE_VPE
,
DESCHEDULE_VPE
,
INVALL_VPE
,
INVALL_VPE
,
PROP_UPDATE_VSGI
,
};
};
struct
its_cmd_info
{
struct
its_cmd_info
{
...
@@ -105,19 +118,27 @@ struct its_cmd_info {
...
@@ -105,19 +118,27 @@ struct its_cmd_info {
bool
g0en
;
bool
g0en
;
bool
g1en
;
bool
g1en
;
};
};
struct
{
u8
priority
;
bool
group
;
};
};
};
};
};
int
its_alloc_vcpu_irqs
(
struct
its_vm
*
vm
);
int
its_alloc_vcpu_irqs
(
struct
its_vm
*
vm
);
void
its_free_vcpu_irqs
(
struct
its_vm
*
vm
);
void
its_free_vcpu_irqs
(
struct
its_vm
*
vm
);
int
its_schedule_vpe
(
struct
its_vpe
*
vpe
,
bool
on
);
int
its_make_vpe_resident
(
struct
its_vpe
*
vpe
,
bool
g0en
,
bool
g1en
);
int
its_make_vpe_non_resident
(
struct
its_vpe
*
vpe
,
bool
db
);
int
its_invall_vpe
(
struct
its_vpe
*
vpe
);
int
its_invall_vpe
(
struct
its_vpe
*
vpe
);
int
its_map_vlpi
(
int
irq
,
struct
its_vlpi_map
*
map
);
int
its_map_vlpi
(
int
irq
,
struct
its_vlpi_map
*
map
);
int
its_get_vlpi
(
int
irq
,
struct
its_vlpi_map
*
map
);
int
its_get_vlpi
(
int
irq
,
struct
its_vlpi_map
*
map
);
int
its_unmap_vlpi
(
int
irq
);
int
its_unmap_vlpi
(
int
irq
);
int
its_prop_update_vlpi
(
int
irq
,
u8
config
,
bool
inv
);
int
its_prop_update_vlpi
(
int
irq
,
u8
config
,
bool
inv
);
int
its_prop_update_vsgi
(
int
irq
,
u8
priority
,
bool
group
);
struct
irq_domain_ops
;
struct
irq_domain_ops
;
int
its_init_v4
(
struct
irq_domain
*
domain
,
const
struct
irq_domain_ops
*
ops
);
int
its_init_v4
(
struct
irq_domain
*
domain
,
const
struct
irq_domain_ops
*
vpe_ops
,
const
struct
irq_domain_ops
*
sgi_ops
);
#endif
#endif
virt/kvm/arm/vgic/vgic-v3.c
View file @
771df8cf
...
@@ -595,7 +595,9 @@ int vgic_v3_probe(const struct gic_kvm_info *info)
...
@@ -595,7 +595,9 @@ int vgic_v3_probe(const struct gic_kvm_info *info)
/* GICv4 support? */
/* GICv4 support? */
if
(
info
->
has_v4
)
{
if
(
info
->
has_v4
)
{
kvm_vgic_global_state
.
has_gicv4
=
gicv4_enable
;
kvm_vgic_global_state
.
has_gicv4
=
gicv4_enable
;
kvm_info
(
"GICv4 support %sabled
\n
"
,
kvm_vgic_global_state
.
has_gicv4_1
=
info
->
has_v4_1
&&
gicv4_enable
;
kvm_info
(
"GICv4%s support %sabled
\n
"
,
kvm_vgic_global_state
.
has_gicv4_1
?
".1"
:
""
,
gicv4_enable
?
"en"
:
"dis"
);
gicv4_enable
?
"en"
:
"dis"
);
}
}
...
...
virt/kvm/arm/vgic/vgic-v4.c
View file @
771df8cf
...
@@ -67,10 +67,10 @@
...
@@ -67,10 +67,10 @@
* it. And if we've migrated our vcpu from one CPU to another, we must
* it. And if we've migrated our vcpu from one CPU to another, we must
* tell the ITS (so that the messages reach the right redistributor).
* tell the ITS (so that the messages reach the right redistributor).
* This is done in two steps: first issue a irq_set_affinity() on the
* This is done in two steps: first issue a irq_set_affinity() on the
* irq corresponding to the vcpu, then call its_
schedule_vpe(). You
* irq corresponding to the vcpu, then call its_
make_vpe_resident().
*
must be in a non-preemptible context. On exit, another
call to
*
You must be in a non-preemptible context. On exit, a
call to
* its_
schedule_vpe() tells the redistributor that we're done with th
e
* its_
make_vpe_non_resident() tells the redistributor that we're don
e
* vcpu.
*
with the
vcpu.
*
*
* Finally, the doorbell handling: Each vcpu is allocated an interrupt
* Finally, the doorbell handling: Each vcpu is allocated an interrupt
* which will fire each time a VLPI is made pending whilst the vcpu is
* which will fire each time a VLPI is made pending whilst the vcpu is
...
@@ -86,7 +86,8 @@ static irqreturn_t vgic_v4_doorbell_handler(int irq, void *info)
...
@@ -86,7 +86,8 @@ static irqreturn_t vgic_v4_doorbell_handler(int irq, void *info)
struct
kvm_vcpu
*
vcpu
=
info
;
struct
kvm_vcpu
*
vcpu
=
info
;
/* We got the message, no need to fire again */
/* We got the message, no need to fire again */
if
(
!
irqd_irq_disabled
(
&
irq_to_desc
(
irq
)
->
irq_data
))
if
(
!
kvm_vgic_global_state
.
has_gicv4_1
&&
!
irqd_irq_disabled
(
&
irq_to_desc
(
irq
)
->
irq_data
))
disable_irq_nosync
(
irq
);
disable_irq_nosync
(
irq
);
vcpu
->
arch
.
vgic_cpu
.
vgic_v3
.
its_vpe
.
pending_last
=
true
;
vcpu
->
arch
.
vgic_cpu
.
vgic_v3
.
its_vpe
.
pending_last
=
true
;
...
@@ -199,19 +200,11 @@ void vgic_v4_teardown(struct kvm *kvm)
...
@@ -199,19 +200,11 @@ void vgic_v4_teardown(struct kvm *kvm)
int
vgic_v4_put
(
struct
kvm_vcpu
*
vcpu
,
bool
need_db
)
int
vgic_v4_put
(
struct
kvm_vcpu
*
vcpu
,
bool
need_db
)
{
{
struct
its_vpe
*
vpe
=
&
vcpu
->
arch
.
vgic_cpu
.
vgic_v3
.
its_vpe
;
struct
its_vpe
*
vpe
=
&
vcpu
->
arch
.
vgic_cpu
.
vgic_v3
.
its_vpe
;
struct
irq_desc
*
desc
=
irq_to_desc
(
vpe
->
irq
);
if
(
!
vgic_supports_direct_msis
(
vcpu
->
kvm
)
||
!
vpe
->
resident
)
if
(
!
vgic_supports_direct_msis
(
vcpu
->
kvm
)
||
!
vpe
->
resident
)
return
0
;
return
0
;
/*
return
its_make_vpe_non_resident
(
vpe
,
need_db
);
* If blocking, a doorbell is required. Undo the nested
* disable_irq() calls...
*/
while
(
need_db
&&
irqd_irq_disabled
(
&
desc
->
irq_data
))
enable_irq
(
vpe
->
irq
);
return
its_schedule_vpe
(
vpe
,
false
);
}
}
int
vgic_v4_load
(
struct
kvm_vcpu
*
vcpu
)
int
vgic_v4_load
(
struct
kvm_vcpu
*
vcpu
)
...
@@ -232,18 +225,19 @@ int vgic_v4_load(struct kvm_vcpu *vcpu)
...
@@ -232,18 +225,19 @@ int vgic_v4_load(struct kvm_vcpu *vcpu)
if
(
err
)
if
(
err
)
return
err
;
return
err
;
/* Disabled the doorbell, as we're about to enter the guest */
err
=
its_make_vpe_resident
(
vpe
,
false
,
vcpu
->
kvm
->
arch
.
vgic
.
enabled
);
disable_irq_nosync
(
vpe
->
irq
);
err
=
its_schedule_vpe
(
vpe
,
true
);
if
(
err
)
if
(
err
)
return
err
;
return
err
;
/*
/*
* Now that the VPE is resident, let's get rid of a potential
* Now that the VPE is resident, let's get rid of a potential
* doorbell interrupt that would still be pending.
* doorbell interrupt that would still be pending. This is a
* GICv4.0 only "feature"...
*/
*/
return
irq_set_irqchip_state
(
vpe
->
irq
,
IRQCHIP_STATE_PENDING
,
false
);
if
(
!
kvm_vgic_global_state
.
has_gicv4_1
)
err
=
irq_set_irqchip_state
(
vpe
->
irq
,
IRQCHIP_STATE_PENDING
,
false
);
return
err
;
}
}
static
struct
vgic_its
*
vgic_get_its
(
struct
kvm
*
kvm
,
static
struct
vgic_its
*
vgic_get_its
(
struct
kvm
*
kvm
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment