1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

vmm: Remove vcpuid from I/O port handlers.

No I/O ports are vCPU-specific (unlike memory which does have
vCPU-specific ranges such as the local APIC).

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37163
This commit is contained in:
John Baldwin 2022-11-18 10:03:14 -08:00
parent 80cb5d845b
commit 9388bc1e3a
10 changed files with 27 additions and 33 deletions

View File

@ -712,7 +712,7 @@ vatpic_write(struct vatpic *vatpic, struct atpic *atpic, bool in, int port,
}
int
vatpic_master_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
vatpic_master_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax)
{
struct vatpic *vatpic;
@ -732,7 +732,7 @@ vatpic_master_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
}
int
vatpic_slave_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
vatpic_slave_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax)
{
struct vatpic *vatpic;
@ -752,7 +752,7 @@ vatpic_slave_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
}
int
vatpic_elc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
vatpic_elc_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax)
{
struct vatpic *vatpic;

View File

@ -41,11 +41,11 @@ struct vm_snapshot_meta;
struct vatpic *vatpic_init(struct vm *vm);
void vatpic_cleanup(struct vatpic *vatpic);
int vatpic_master_handler(struct vm *vm, int vcpuid, bool in, int port,
int bytes, uint32_t *eax);
int vatpic_slave_handler(struct vm *vm, int vcpuid, bool in, int port,
int bytes, uint32_t *eax);
int vatpic_elc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
int vatpic_master_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax);
int vatpic_slave_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax);
int vatpic_elc_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax);
int vatpic_assert_irq(struct vm *vm, int irq);

View File

@ -336,8 +336,7 @@ vatpit_update_mode(struct vatpit *vatpit, uint8_t val)
}
int
vatpit_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
uint32_t *eax)
vatpit_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *eax)
{
struct vatpit *vatpit;
struct channel *c;
@ -419,7 +418,7 @@ vatpit_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
}
int
vatpit_nmisc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
vatpit_nmisc_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax)
{
struct vatpit *vatpit;

View File

@ -41,10 +41,9 @@ struct vm_snapshot_meta;
struct vatpit *vatpit_init(struct vm *vm);
void vatpit_cleanup(struct vatpit *vatpit);
int vatpit_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
int vatpit_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *eax);
int vatpit_nmisc_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax);
int vatpit_nmisc_handler(struct vm *vm, int vcpuid, bool in, int port,
int bytes, uint32_t *eax);
#ifdef BHYVE_SNAPSHOT
int vatpit_snapshot(struct vatpit *vatpit, struct vm_snapshot_meta *meta);
#endif

View File

@ -83,8 +83,7 @@ vpmtmr_cleanup(struct vpmtmr *vpmtmr)
}
int
vpmtmr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
uint32_t *val)
vpmtmr_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *val)
{
struct vpmtmr *vpmtmr;
sbintime_t now, delta;

View File

@ -39,8 +39,7 @@ struct vm_snapshot_meta;
struct vpmtmr *vpmtmr_init(struct vm *vm);
void vpmtmr_cleanup(struct vpmtmr *pmtmr);
int vpmtmr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
uint32_t *val);
int vpmtmr_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *val);
#ifdef BHYVE_SNAPSHOT
int vpmtmr_snapshot(struct vpmtmr *vpmtmr, struct vm_snapshot_meta *meta);

View File

@ -844,8 +844,7 @@ vrtc_nvram_read(struct vm *vm, int offset, uint8_t *retval)
}
int
vrtc_addr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
uint32_t *val)
vrtc_addr_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *val)
{
struct vrtc *vrtc;
@ -867,8 +866,7 @@ vrtc_addr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
}
int
vrtc_data_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
uint32_t *val)
vrtc_data_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *val)
{
struct vrtc *vrtc;
struct rtcdev *rtc;
@ -915,24 +913,24 @@ vrtc_data_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
} else {
*val = *((uint8_t *)rtc + offset);
}
VCPU_CTR2(vm, vcpuid, "Read value %#x from RTC offset %#x",
VM_CTR2(vm, "Read value %#x from RTC offset %#x",
*val, offset);
} else {
switch (offset) {
case 10:
VCPU_CTR1(vm, vcpuid, "RTC reg_a set to %#x", *val);
VM_CTR1(vm, "RTC reg_a set to %#x", *val);
vrtc_set_reg_a(vrtc, *val);
break;
case 11:
VCPU_CTR1(vm, vcpuid, "RTC reg_b set to %#x", *val);
VM_CTR1(vm, "RTC reg_b set to %#x", *val);
error = vrtc_set_reg_b(vrtc, *val);
break;
case 12:
VCPU_CTR1(vm, vcpuid, "RTC reg_c set to %#x (ignored)",
VM_CTR1(vm, "RTC reg_c set to %#x (ignored)",
*val);
break;
case 13:
VCPU_CTR1(vm, vcpuid, "RTC reg_d set to %#x (ignored)",
VM_CTR1(vm, "RTC reg_d set to %#x (ignored)",
*val);
break;
case 0:
@ -942,7 +940,7 @@ vrtc_data_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
*val &= 0x7f;
/* FALLTHRU */
default:
VCPU_CTR2(vm, vcpuid, "RTC offset %#x set to %#x",
VM_CTR2(vm, "RTC offset %#x set to %#x",
offset, *val);
*((uint8_t *)rtc + offset) = *val;
break;

View File

@ -45,9 +45,9 @@ int vrtc_set_time(struct vm *vm, time_t secs);
int vrtc_nvram_write(struct vm *vm, int offset, uint8_t value);
int vrtc_nvram_read(struct vm *vm, int offset, uint8_t *retval);
int vrtc_addr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
int vrtc_addr_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *val);
int vrtc_data_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
int vrtc_data_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *val);
#ifdef BHYVE_SNAPSHOT

View File

@ -122,8 +122,8 @@ emulate_inout_port(struct vm *vm, int vcpuid, struct vm_exit *vmexit,
val = vmexit->u.inout.eax & mask;
}
error = (*handler)(vm, vcpuid, vmexit->u.inout.in,
vmexit->u.inout.port, vmexit->u.inout.bytes, &val);
error = (*handler)(vm, vmexit->u.inout.in, vmexit->u.inout.port,
vmexit->u.inout.bytes, &val);
if (error) {
/*
* The value returned by this function is also the return value

View File

@ -31,7 +31,7 @@
#ifndef _VMM_IOPORT_H_
#define _VMM_IOPORT_H_
typedef int (*ioport_handler_func_t)(struct vm *vm, int vcpuid,
typedef int (*ioport_handler_func_t)(struct vm *vm,
bool in, int port, int bytes, uint32_t *val);
int vm_handle_inout(struct vm *vm, int vcpuid, struct vm_exit *vme, bool *retu);