Skip to content

Commit 8e2efd6

Browse files
donshengwenlingz
authored andcommitted
hv: rename vlapic_pir_desc to pi_desc
Rename struct vlapic_pir_desc to pi_desc Rename struct member and local variable pir_desc to pid pir=posted interrupt request, pi=posted interrupt pid=posted interrupt descriptor pir is part of pi descriptor, so it is better to use pi instead of pir struct pi_desc will be moved to vmx.h in subsequent commit. Tracked-On: #4506 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@Intel.com>
1 parent 233577e commit 8e2efd6

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ uint64_t apicv_get_pir_desc_paddr(struct acrn_vcpu *vcpu)
629629
struct acrn_vlapic *vlapic;
630630

631631
vlapic = &vcpu->arch.vlapic;
632-
return hva2hpa(&(vlapic->pir_desc));
632+
return hva2hpa(&(vlapic->pid));
633633
}
634634

635635
/**
@@ -1672,7 +1672,7 @@ vlapic_reset(struct acrn_vlapic *vlapic, const struct acrn_apicv_ops *ops, enum
16721672

16731673
lapic = &(vlapic->apic_page);
16741674
(void)memset((void *)lapic, 0U, sizeof(struct lapic_regs));
1675-
(void)memset((void *)&(vlapic->pir_desc), 0U, sizeof(vlapic->pir_desc));
1675+
(void)memset((void *)&(vlapic->pid), 0U, sizeof(vlapic->pid));
16761676

16771677
if (mode == INIT_RESET) {
16781678
if ((preserved_lapic_mode & APICBASE_ENABLED) != 0U ) {
@@ -2229,16 +2229,16 @@ void vlapic_free(struct acrn_vcpu *vcpu)
22292229
static bool
22302230
apicv_set_intr_ready(struct acrn_vlapic *vlapic, uint32_t vector)
22312231
{
2232-
struct vlapic_pir_desc *pir_desc;
2232+
struct pi_desc *pid;
22332233
uint32_t idx;
22342234
bool notify = false;
22352235

2236-
pir_desc = &(vlapic->pir_desc);
2236+
pid = &(vlapic->pid);
22372237

22382238
idx = vector >> 6U;
22392239

2240-
if (!bitmap_test_and_set_lock((uint16_t)(vector & 0x3fU), &pir_desc->pir[idx])) {
2241-
notify = (atomic_cmpxchg64(&pir_desc->pending, 0UL, 1UL) == 0UL);
2240+
if (!bitmap_test_and_set_lock((uint16_t)(vector & 0x3fU), &pid->pir[idx])) {
2241+
notify = (atomic_cmpxchg64(&pid->pending, 0UL, 1UL) == 0UL);
22422242
}
22432243
return notify;
22442244
}
@@ -2289,21 +2289,21 @@ static bool apicv_basic_inject_intr(struct acrn_vlapic *vlapic,
22892289
*/
22902290
static void vlapic_apicv_inject_pir(struct acrn_vlapic *vlapic)
22912291
{
2292-
struct vlapic_pir_desc *pir_desc;
2292+
struct pi_desc *pid;
22932293
struct lapic_regs *lapic;
22942294
uint64_t val, pirval;
22952295
uint16_t rvi, pirbase = 0U, i;
22962296
uint16_t intr_status_old, intr_status_new;
22972297
struct lapic_reg *irr = NULL;
22982298

2299-
pir_desc = &(vlapic->pir_desc);
2300-
if (atomic_cmpxchg64(&pir_desc->pending, 1UL, 0UL) == 1UL) {
2299+
pid = &(vlapic->pid);
2300+
if (atomic_cmpxchg64(&pid->pending, 1UL, 0UL) == 1UL) {
23012301
pirval = 0UL;
23022302
lapic = &(vlapic->apic_page);
23032303
irr = &lapic->irr[0];
23042304

23052305
for (i = 0U; i < 4U; i++) {
2306-
val = atomic_readandclear64(&pir_desc->pir[i]);
2306+
val = atomic_readandclear64(&pid->pir[i]);
23072307
if (val != 0UL) {
23082308
irr[i * 2U].v |= (uint32_t)val;
23092309
irr[(i * 2U) + 1U].v |= (uint32_t)(val >> 32U);

hypervisor/include/arch/x86/guest/vlapic.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343

4444
#define VLAPIC_MAXLVT_INDEX APIC_LVT_CMCI
4545

46-
struct vlapic_pir_desc {
46+
/* Posted Interrupt Descriptor (PID) in VT-d spec */
47+
struct pi_desc {
48+
/* Posted Interrupt Requests, one bit per requested vector */
4749
uint64_t pir[4];
4850
uint64_t pending;
4951
uint64_t unused[3];
@@ -58,16 +60,16 @@ struct vlapic_timer {
5860

5961
struct acrn_vlapic {
6062
/*
61-
* Please keep 'apic_page' and 'pir_desc' be the first two fields in
63+
* Please keep 'apic_page' and 'pid' be the first two fields in
6264
* current structure, as below alignment restrictions are mandatory
6365
* to support APICv features:
6466
* - 'apic_page' MUST be 4KB aligned.
65-
* - 'pir_desc' MUST be 64 bytes aligned.
67+
* - 'pid' MUST be 64 bytes aligned.
6668
* IRR, TMR and PIR could be accessed by other vCPUs when deliver
6769
* an interrupt to vLAPIC.
6870
*/
6971
struct lapic_regs apic_page;
70-
struct vlapic_pir_desc pir_desc;
72+
struct pi_desc pid;
7173

7274
struct acrn_vm *vm;
7375
struct acrn_vcpu *vcpu;

0 commit comments

Comments
 (0)