Add a callback to be notified about negotiated features.

Submitted by:	luigi
Obtained from:	Vincenzo Maffione, Universita` di Pisa
MFC after:	3 days
This commit is contained in:
Peter Grehan 2014-09-09 04:11:54 +00:00
parent 72d33245f5
commit e18f344b9b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271299
5 changed files with 8 additions and 0 deletions

View File

@ -133,6 +133,7 @@ static struct virtio_consts vtblk_vi_consts = {
pci_vtblk_notify, /* device-wide qnotify */
pci_vtblk_cfgread, /* read PCI config */
pci_vtblk_cfgwrite, /* write PCI config */
NULL, /* apply negotiated features */
VTBLK_S_HOSTCAPS, /* our capabilities */
};

View File

@ -160,6 +160,7 @@ static struct virtio_consts vtnet_vi_consts = {
NULL, /* device-wide qnotify -- not used */
pci_vtnet_cfgread, /* read PCI config */
pci_vtnet_cfgwrite, /* write PCI config */
NULL, /* apply negotiated features */
VTNET_S_HOSTCAPS, /* our capabilities */
};

View File

@ -80,6 +80,7 @@ static struct virtio_consts vtrnd_vi_consts = {
pci_vtrnd_notify, /* device-wide qnotify */
NULL, /* read virtio config */
NULL, /* write virtio config */
NULL, /* apply negotiated features */
0, /* our capabilities */
};

View File

@ -698,6 +698,9 @@ vi_pci_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
switch (offset) {
case VTCFG_R_GUESTCAP:
vs->vs_negotiated_caps = value & vc->vc_hv_caps;
if (vc->vc_apply_features)
(*vc->vc_apply_features)(DEV_SOFTC(vs),
vs->vs_negotiated_caps);
break;
case VTCFG_R_PFN:
if (vs->vs_curq >= vc->vc_nvq)

View File

@ -352,6 +352,8 @@ struct virtio_consts {
/* called to read config regs */
int (*vc_cfgwrite)(void *, int, int, uint32_t);
/* called to write config regs */
void (*vc_apply_features)(void *, uint64_t);
/* called to apply negotiated features */
uint64_t vc_hv_caps; /* hypervisor-provided capabilities */
};