*/
#define SVM_CR0_ALLOWED_BITS (~X86_CR0_NW)
+/* IOPM size: two 4-K pages + 3 bits */
+#define IOPM_PAGES 3
+
static bool has_avic, has_assists, has_flush_by_asid;
static const struct segment invalid_seg;
int err = -ENOMEM;
u64 flags;
- /* allocate iopm (two 4-K pages + 3 bits) */
- cell->arch.svm.iopm = page_alloc(&mem_pool, 3);
+ /* allocate iopm */
+ cell->arch.svm.iopm = page_alloc(&mem_pool, IOPM_PAGES);
if (!cell->arch.svm.iopm)
return err;
struct vcpu_io_bitmap *iobm)
{
iobm->data = cell->arch.svm.iopm;
- iobm->size = sizeof(cell->arch.svm.iopm);
+ iobm->size = IOPM_PAGES * PAGE_SIZE;
}
void vcpu_vendor_get_execution_state(struct vcpu_execution_state *x_state)
#include <asm/vcpu.h>
#include <asm/vmx.h>
-#define CR0_IDX 0
-#define CR4_IDX 1
+#define CR0_IDX 0
+#define CR4_IDX 1
+
+#define PIO_BITMAP_PAGES 2
static const struct segment invalid_seg = {
.access_rights = 0x10000
int err = -ENOMEM;
/* allocate io_bitmap */
- cell->arch.vmx.io_bitmap = page_alloc(&mem_pool, 2);
+ cell->arch.vmx.io_bitmap = page_alloc(&mem_pool, PIO_BITMAP_PAGES);
if (!cell->arch.vmx.io_bitmap)
return err;
struct vcpu_io_bitmap *iobm)
{
iobm->data = cell->arch.vmx.io_bitmap;
- iobm->size = sizeof(cell->arch.vmx.io_bitmap);
+ iobm->size = PIO_BITMAP_PAGES * PAGE_SIZE;
}
void vcpu_vendor_get_execution_state(struct vcpu_execution_state *x_state)