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>
This commit is contained in:
yuhong.tao@intel.com
2019-03-22 10:45:33 +00:00
committed by wenlingz
parent 06761102a8
commit c55308bd3d
5 changed files with 36 additions and 566 deletions

View File

@@ -326,11 +326,11 @@ vmexit_inout(struct vmctx *ctx, struct vhm_request *vhm_req, int *pvcpu)
int error;
int bytes, port, in;
port = vhm_req->reqs.pio_request.address;
bytes = vhm_req->reqs.pio_request.size;
in = (vhm_req->reqs.pio_request.direction == REQUEST_READ);
port = vhm_req->reqs.pio.address;
bytes = vhm_req->reqs.pio.size;
in = (vhm_req->reqs.pio.direction == REQUEST_READ);
error = emulate_inout(ctx, pvcpu, &vhm_req->reqs.pio_request);
error = emulate_inout(ctx, pvcpu, &vhm_req->reqs.pio);
if (error) {
fprintf(stderr, "Unhandled %s%c 0x%04x\n",
in ? "in" : "out",
@@ -338,7 +338,7 @@ vmexit_inout(struct vmctx *ctx, struct vhm_request *vhm_req, int *pvcpu)
port);
if (in) {
vhm_req->reqs.pio_request.value = VHM_REQ_PIO_INVAL;
vhm_req->reqs.pio.value = VHM_REQ_PIO_INVAL;
}
}
}
@@ -349,20 +349,20 @@ vmexit_mmio_emul(struct vmctx *ctx, struct vhm_request *vhm_req, int *pvcpu)
int err;
stats.vmexit_mmio_emul++;
err = emulate_mem(ctx, &vhm_req->reqs.mmio_request);
err = emulate_mem(ctx, &vhm_req->reqs.mmio);
if (err) {
if (err == -ESRCH)
fprintf(stderr, "Unhandled memory access to 0x%lx\n",
vhm_req->reqs.mmio_request.address);
vhm_req->reqs.mmio.address);
fprintf(stderr, "Failed to emulate instruction [");
fprintf(stderr, "mmio address 0x%lx, size %ld",
vhm_req->reqs.mmio_request.address,
vhm_req->reqs.mmio_request.size);
vhm_req->reqs.mmio.address,
vhm_req->reqs.mmio.size);
if (vhm_req->reqs.mmio_request.direction == REQUEST_READ) {
vhm_req->reqs.mmio_request.value = VHM_REQ_MMIO_INVAL;
if (vhm_req->reqs.mmio.direction == REQUEST_READ) {
vhm_req->reqs.mmio.value = VHM_REQ_MMIO_INVAL;
}
}
}
@@ -370,24 +370,24 @@ vmexit_mmio_emul(struct vmctx *ctx, struct vhm_request *vhm_req, int *pvcpu)
static void
vmexit_pci_emul(struct vmctx *ctx, struct vhm_request *vhm_req, int *pvcpu)
{
int err, in = (vhm_req->reqs.pci_request.direction == REQUEST_READ);
int err, in = (vhm_req->reqs.pci.direction == REQUEST_READ);
err = emulate_pci_cfgrw(ctx, *pvcpu, in,
vhm_req->reqs.pci_request.bus,
vhm_req->reqs.pci_request.dev,
vhm_req->reqs.pci_request.func,
vhm_req->reqs.pci_request.reg,
vhm_req->reqs.pci_request.size,
&vhm_req->reqs.pci_request.value);
vhm_req->reqs.pci.bus,
vhm_req->reqs.pci.dev,
vhm_req->reqs.pci.func,
vhm_req->reqs.pci.reg,
vhm_req->reqs.pci.size,
&vhm_req->reqs.pci.value);
if (err) {
fprintf(stderr, "Unhandled pci cfg rw at %x:%x.%x reg 0x%x\n",
vhm_req->reqs.pci_request.bus,
vhm_req->reqs.pci_request.dev,
vhm_req->reqs.pci_request.func,
vhm_req->reqs.pci_request.reg);
vhm_req->reqs.pci.bus,
vhm_req->reqs.pci.dev,
vhm_req->reqs.pci.func,
vhm_req->reqs.pci.reg);
if (in) {
vhm_req->reqs.pio_request.value = VHM_REQ_PIO_INVAL;
vhm_req->reqs.pio.value = VHM_REQ_PIO_INVAL;
}
}
}

View File

@@ -136,16 +136,16 @@ vm_create(const char *name, uint64_t req_buf)
/* Set trusty enable flag */
if (trusty_enabled)
create_vm.vm_flag |= SECURE_WORLD_ENABLED;
create_vm.vm_flag |= GUEST_FLAG_SECURE_WORLD_ENABLED;
else
create_vm.vm_flag &= (~SECURE_WORLD_ENABLED);
create_vm.vm_flag &= (~GUEST_FLAG_SECURE_WORLD_ENABLED);
if (lapic_pt) {
create_vm.vm_flag |= LAPIC_PASSTHROUGH;
create_vm.vm_flag |= IOREQ_COMPLETION_POLLING;
create_vm.vm_flag |= GUEST_FLAG_LAPIC_PASSTHROUGH;
create_vm.vm_flag |= GUEST_FLAG_IO_COMPLETION_POLLING;
} else {
create_vm.vm_flag &= (~LAPIC_PASSTHROUGH);
create_vm.vm_flag &= (~IOREQ_COMPLETION_POLLING);
create_vm.vm_flag &= (~GUEST_FLAG_LAPIC_PASSTHROUGH);
create_vm.vm_flag &= (~GUEST_FLAG_IO_COMPLETION_POLLING);
}
create_vm.req_buf = req_buf;
@@ -463,7 +463,7 @@ vm_set_gsi_irq(struct vmctx *ctx, int gsi, uint32_t operation)
uint64_t *req = (uint64_t *)&op;
op.op = operation;
op.nr_gsi = (uint32_t)gsi;
op.gsi = (uint32_t)gsi;
return ioctl(ctx->fd, IC_SET_IRQLINE, *req);
}