Skip to content

Commit c55308b

Browse files
taoyuhongwenlingz
authored andcommitted
DM: use soft link of acrn_common.h in HV
devicemodel/include/public/acrn_common.h should be identical with hypervisor/include/public/acrn_common.h, so we can use a soft link to hypervisor's acrn_common.h for devicemodel. Tracked-On: #2851 Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
1 parent 0676110 commit c55308b

File tree

5 files changed

+36
-566
lines changed

5 files changed

+36
-566
lines changed

devicemodel/core/main.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -326,19 +326,19 @@ vmexit_inout(struct vmctx *ctx, struct vhm_request *vhm_req, int *pvcpu)
326326
int error;
327327
int bytes, port, in;
328328

329-
port = vhm_req->reqs.pio_request.address;
330-
bytes = vhm_req->reqs.pio_request.size;
331-
in = (vhm_req->reqs.pio_request.direction == REQUEST_READ);
329+
port = vhm_req->reqs.pio.address;
330+
bytes = vhm_req->reqs.pio.size;
331+
in = (vhm_req->reqs.pio.direction == REQUEST_READ);
332332

333-
error = emulate_inout(ctx, pvcpu, &vhm_req->reqs.pio_request);
333+
error = emulate_inout(ctx, pvcpu, &vhm_req->reqs.pio);
334334
if (error) {
335335
fprintf(stderr, "Unhandled %s%c 0x%04x\n",
336336
in ? "in" : "out",
337337
bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'),
338338
port);
339339

340340
if (in) {
341-
vhm_req->reqs.pio_request.value = VHM_REQ_PIO_INVAL;
341+
vhm_req->reqs.pio.value = VHM_REQ_PIO_INVAL;
342342
}
343343
}
344344
}
@@ -349,45 +349,45 @@ vmexit_mmio_emul(struct vmctx *ctx, struct vhm_request *vhm_req, int *pvcpu)
349349
int err;
350350

351351
stats.vmexit_mmio_emul++;
352-
err = emulate_mem(ctx, &vhm_req->reqs.mmio_request);
352+
err = emulate_mem(ctx, &vhm_req->reqs.mmio);
353353

354354
if (err) {
355355
if (err == -ESRCH)
356356
fprintf(stderr, "Unhandled memory access to 0x%lx\n",
357-
vhm_req->reqs.mmio_request.address);
357+
vhm_req->reqs.mmio.address);
358358

359359
fprintf(stderr, "Failed to emulate instruction [");
360360
fprintf(stderr, "mmio address 0x%lx, size %ld",
361-
vhm_req->reqs.mmio_request.address,
362-
vhm_req->reqs.mmio_request.size);
361+
vhm_req->reqs.mmio.address,
362+
vhm_req->reqs.mmio.size);
363363

364-
if (vhm_req->reqs.mmio_request.direction == REQUEST_READ) {
365-
vhm_req->reqs.mmio_request.value = VHM_REQ_MMIO_INVAL;
364+
if (vhm_req->reqs.mmio.direction == REQUEST_READ) {
365+
vhm_req->reqs.mmio.value = VHM_REQ_MMIO_INVAL;
366366
}
367367
}
368368
}
369369

370370
static void
371371
vmexit_pci_emul(struct vmctx *ctx, struct vhm_request *vhm_req, int *pvcpu)
372372
{
373-
int err, in = (vhm_req->reqs.pci_request.direction == REQUEST_READ);
373+
int err, in = (vhm_req->reqs.pci.direction == REQUEST_READ);
374374

375375
err = emulate_pci_cfgrw(ctx, *pvcpu, in,
376-
vhm_req->reqs.pci_request.bus,
377-
vhm_req->reqs.pci_request.dev,
378-
vhm_req->reqs.pci_request.func,
379-
vhm_req->reqs.pci_request.reg,
380-
vhm_req->reqs.pci_request.size,
381-
&vhm_req->reqs.pci_request.value);
376+
vhm_req->reqs.pci.bus,
377+
vhm_req->reqs.pci.dev,
378+
vhm_req->reqs.pci.func,
379+
vhm_req->reqs.pci.reg,
380+
vhm_req->reqs.pci.size,
381+
&vhm_req->reqs.pci.value);
382382
if (err) {
383383
fprintf(stderr, "Unhandled pci cfg rw at %x:%x.%x reg 0x%x\n",
384-
vhm_req->reqs.pci_request.bus,
385-
vhm_req->reqs.pci_request.dev,
386-
vhm_req->reqs.pci_request.func,
387-
vhm_req->reqs.pci_request.reg);
384+
vhm_req->reqs.pci.bus,
385+
vhm_req->reqs.pci.dev,
386+
vhm_req->reqs.pci.func,
387+
vhm_req->reqs.pci.reg);
388388

389389
if (in) {
390-
vhm_req->reqs.pio_request.value = VHM_REQ_PIO_INVAL;
390+
vhm_req->reqs.pio.value = VHM_REQ_PIO_INVAL;
391391
}
392392
}
393393
}

devicemodel/core/vmmapi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,16 @@ vm_create(const char *name, uint64_t req_buf)
136136

137137
/* Set trusty enable flag */
138138
if (trusty_enabled)
139-
create_vm.vm_flag |= SECURE_WORLD_ENABLED;
139+
create_vm.vm_flag |= GUEST_FLAG_SECURE_WORLD_ENABLED;
140140
else
141-
create_vm.vm_flag &= (~SECURE_WORLD_ENABLED);
141+
create_vm.vm_flag &= (~GUEST_FLAG_SECURE_WORLD_ENABLED);
142142

143143
if (lapic_pt) {
144-
create_vm.vm_flag |= LAPIC_PASSTHROUGH;
145-
create_vm.vm_flag |= IOREQ_COMPLETION_POLLING;
144+
create_vm.vm_flag |= GUEST_FLAG_LAPIC_PASSTHROUGH;
145+
create_vm.vm_flag |= GUEST_FLAG_IO_COMPLETION_POLLING;
146146
} else {
147-
create_vm.vm_flag &= (~LAPIC_PASSTHROUGH);
148-
create_vm.vm_flag &= (~IOREQ_COMPLETION_POLLING);
147+
create_vm.vm_flag &= (~GUEST_FLAG_LAPIC_PASSTHROUGH);
148+
create_vm.vm_flag &= (~GUEST_FLAG_IO_COMPLETION_POLLING);
149149
}
150150

151151
create_vm.req_buf = req_buf;
@@ -463,7 +463,7 @@ vm_set_gsi_irq(struct vmctx *ctx, int gsi, uint32_t operation)
463463
uint64_t *req = (uint64_t *)&op;
464464

465465
op.op = operation;
466-
op.nr_gsi = (uint32_t)gsi;
466+
op.gsi = (uint32_t)gsi;
467467

468468
return ioctl(ctx->fd, IC_SET_IRQLINE, *req);
469469
}

0 commit comments

Comments
 (0)