Skip to content

Commit dcd6d8b

Browse files
ying2liuacrnsi
authored andcommitted
DM: remove unused function virtio_pci_modern_cfgread and virtio_pci_modern_cfgwrite
Change-Id: I3f362858956a642ae0de9ab36387e274fc939659 Tracked-On: #3123 Signed-off-by: Ying Liu <ying2.liu@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent 62f14bb commit dcd6d8b

File tree

2 files changed

+0
-163
lines changed

2 files changed

+0
-163
lines changed

devicemodel/hw/pci/virtio/virtio.c

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,131 +1839,6 @@ virtio_pci_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
18391839
base->vops->name, baridx);
18401840
}
18411841

1842-
/**
1843-
* @brief Handle PCI configuration space reads.
1844-
*
1845-
* Handle virtio PCI configuration space reads. Only the specific registers
1846-
* that need speical operation are handled in this callback. For others just
1847-
* fallback to pci core. This interface is only valid for virtio modern.
1848-
*
1849-
* @param ctx Pointer to struct vmctx representing VM context.
1850-
* @param vcpu VCPU ID.
1851-
* @param dev Pointer to struct pci_vdev which emulates a PCI device.
1852-
* @param coff Register offset in bytes within PCI configuration space.
1853-
* @param bytes Access range in bytes.
1854-
* @param rv The value returned as read.
1855-
*
1856-
* @return 0 on handled and non-zero on non-handled.
1857-
*/
1858-
int
1859-
virtio_pci_modern_cfgread(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
1860-
int coff, int bytes, uint32_t *rv)
1861-
{
1862-
struct virtio_base *base = dev->arg;
1863-
struct virtio_pci_cfg_cap *cfg;
1864-
uint32_t value;
1865-
int cfg_coff = base->cfg_coff;
1866-
size_t cfg_data_offset;
1867-
1868-
cfg_data_offset = offsetof(struct virtio_pci_cfg_cap, pci_cfg_data);
1869-
1870-
/* we only need to handle the read to
1871-
* virtio_pci_cfg_cap.pci_cfg_data[]
1872-
* fallback for anything else by return -1
1873-
*/
1874-
if ((cfg_coff > 0) && (coff >= cfg_coff + cfg_data_offset) &&
1875-
(coff + bytes <= cfg_coff + sizeof(*cfg))) {
1876-
cfg = (struct virtio_pci_cfg_cap *)&dev->cfgdata[cfg_coff];
1877-
if (cfg->cap.bar == base->modern_pio_bar_idx)
1878-
value = virtio_pci_modern_pio_read(ctx, vcpu, dev,
1879-
cfg->cap.bar, cfg->cap.offset, cfg->cap.length);
1880-
else if (cfg->cap.bar == base->modern_mmio_bar_idx)
1881-
value = virtio_pci_modern_mmio_read(ctx, vcpu, dev,
1882-
cfg->cap.bar, cfg->cap.offset, cfg->cap.length);
1883-
else {
1884-
fprintf(stderr, "%s: cfgread unexpected baridx %d\r\n",
1885-
base->vops->name, cfg->cap.bar);
1886-
value = 0;
1887-
}
1888-
1889-
/* update pci_cfg_data */
1890-
if (cfg->cap.length == 1)
1891-
pci_set_cfgdata8(dev, cfg_coff + cfg_data_offset,
1892-
value);
1893-
else if (cfg->cap.length == 2)
1894-
pci_set_cfgdata16(dev, cfg_coff + cfg_data_offset,
1895-
value);
1896-
else
1897-
pci_set_cfgdata32(dev, cfg_coff + cfg_data_offset,
1898-
value);
1899-
1900-
*rv = value;
1901-
return 0;
1902-
}
1903-
1904-
return -1;
1905-
}
1906-
1907-
/**
1908-
* @brief Handle PCI configuration space writes.
1909-
*
1910-
* Handle virtio PCI configuration space writes. Only the specific registers
1911-
* that need speical operation are handled in this callback. For others just
1912-
* fallback to pci core. This interface is only valid for virtio modern.
1913-
*
1914-
* @param ctx Pointer to struct vmctx representing VM context.
1915-
* @param vcpu VCPU ID.
1916-
* @param dev Pointer to struct pci_vdev which emulates a PCI device.
1917-
* @param coff Register offset in bytes within PCI configuration space.
1918-
* @param bytes Access range in bytes.
1919-
* @param val The value to write.
1920-
*
1921-
* @return 0 on handled and non-zero on non-handled.
1922-
*/
1923-
int
1924-
virtio_pci_modern_cfgwrite(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
1925-
int coff, int bytes, uint32_t val)
1926-
{
1927-
struct virtio_base *base = dev->arg;
1928-
struct virtio_pci_cfg_cap *cfg;
1929-
int cfg_coff = base->cfg_coff;
1930-
size_t cfg_data_offset;
1931-
1932-
cfg_data_offset = offsetof(struct virtio_pci_cfg_cap, pci_cfg_data);
1933-
1934-
/* we only need to handle the write to
1935-
* virtio_pci_cfg_cap.pci_cfg_data[]
1936-
* fallback for anything else by return -1
1937-
*/
1938-
if ((cfg_coff > 0) && (coff >= cfg_coff + cfg_data_offset) &&
1939-
(coff + bytes <= cfg_coff + sizeof(*cfg))) {
1940-
/* default cfg write */
1941-
if (bytes == 1)
1942-
pci_set_cfgdata8(dev, coff, val);
1943-
else if (bytes == 2)
1944-
pci_set_cfgdata16(dev, coff, val);
1945-
else
1946-
pci_set_cfgdata32(dev, coff, val);
1947-
1948-
cfg = (struct virtio_pci_cfg_cap *)&dev->cfgdata[cfg_coff];
1949-
if (cfg->cap.bar == base->modern_pio_bar_idx)
1950-
virtio_pci_modern_pio_write(ctx, vcpu, dev,
1951-
cfg->cap.bar, cfg->cap.offset,
1952-
cfg->cap.length, val);
1953-
else if (cfg->cap.bar == base->modern_mmio_bar_idx)
1954-
virtio_pci_modern_mmio_write(ctx, vcpu, dev,
1955-
cfg->cap.bar, cfg->cap.offset,
1956-
cfg->cap.length, val);
1957-
else
1958-
fprintf(stderr, "%s: cfgwrite unexpected baridx %d\r\n",
1959-
base->vops->name, cfg->cap.bar);
1960-
1961-
return 0;
1962-
}
1963-
1964-
return -1;
1965-
}
1966-
19671842
/**
19681843
* @brief Get the virtio poll parameters
19691844
*

devicemodel/include/virtio.h

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -730,44 +730,6 @@ void virtio_pci_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
730730
*/
731731
int virtio_set_modern_bar(struct virtio_base *base, bool use_notify_pio);
732732

733-
/**
734-
* @brief Handle PCI configuration space reads.
735-
*
736-
* Handle virtio PCI configuration space reads. Only the specific registers
737-
* that need speical operation are handled in this callback. For others just
738-
* fallback to pci core. This interface is only valid for virtio modern.
739-
*
740-
* @param ctx Pointer to struct vmctx representing VM context.
741-
* @param vcpu VCPU ID.
742-
* @param dev Pointer to struct pci_vdev which emulates a PCI device.
743-
* @param coff Register offset in bytes within PCI configuration space.
744-
* @param bytes Access range in bytes.
745-
* @param rv The value returned as read.
746-
*
747-
* @return 0 on handled and non-zero on non-handled.
748-
*/
749-
int virtio_pci_modern_cfgread(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
750-
int coff, int bytes, uint32_t *rv);
751-
/**
752-
* @brief Handle PCI configuration space writes.
753-
*
754-
* Handle virtio PCI configuration space writes. Only the specific registers
755-
* that need speical operation are handled in this callback. For others just
756-
* fallback to pci core. This interface is only valid for virtio modern.
757-
*
758-
* @param ctx Pointer to struct vmctx representing VM context.
759-
* @param vcpu VCPU ID.
760-
* @param dev Pointer to struct pci_vdev which emulates a PCI device.
761-
* @param coff Register offset in bytes within PCI configuration space.
762-
* @param bytes Access range in bytes.
763-
* @param val The value to write.
764-
*
765-
* @return 0 on handled and non-zero on non-handled.
766-
*/
767-
int virtio_pci_modern_cfgwrite(struct vmctx *ctx, int vcpu,
768-
struct pci_vdev *dev, int coff, int bytes,
769-
uint32_t val);
770-
771733
/**
772734
* @}
773735
*/

0 commit comments

Comments
 (0)