Vga 20190703 patches
The following changes since commit 506179e42112be77bfd071f050b15762d3b2cd43:
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.1-20190702' into staging (2019-07-02 18:56:44 +0100)
are available in the Git repository at:
git://git.kraxel.org/qemu tags/vga-20190703-pull-request
for you to fetch changes up to 0a87fd693d4e955a6877a2166b65bb7b7192aaaa:
Add ati vgabios to INSTALL_BLOBS. (2019-07-03 10:52:15 +0200)
----------------------------------------------------------------
vga: virtio fixes, bitbang i2c asan fix, install ati vgabios.
----------------------------------------------------------------
Gerd Hoffmann (2):
virtio-gpu: fix unmap in error path
Add ati vgabios to INSTALL_BLOBS.
Li Qiang (1):
virtio-gpu: check if the resource already exists in virtio_gpu_load()
Peter Maydell (1):
hw/i2c/bitbang_i2c: Use in-place rather than malloc'd
bitbang_i2c_interface struct
Makefile | 2 +- hw/display/ati_int.h | 2 +- include/hw/i2c/bitbang_i2c.h | 38 ++++++++++++++++++++++++++++- include/hw/i2c/ppc4xx_i2c.h | 2 +- hw/display/ati.c | 7 +++--- hw/display/virtio-gpu.c | 9 +++++-- hw/i2c/bitbang_i2c.c | 47 +++--------------------------------- hw/i2c/ppc4xx_i2c.c | 6 ++--- hw/i2c/versatile_i2c.c | 8 +++--- 9 files changed, 61 insertions(+), 60 deletions(-)
Signature · 1 line
2.18.1
[Qemu-arm] [PULL 3/4] hw/i2c/bitbang_i2c: Use in-place rather than malloc'd bitbang_i2c_interface struct
From: Peter Maydell <[email protected]>
Currently the bitbang_i2c_init() function allocates a bitbang_i2c_interface struct which it returns. This is unfortunate because it means that if the function is used from a DeviceState init method then the memory will be leaked by an "init then delete" cycle, as used by the qmp/hmp commands that list device properties.
Since three out of four of the uses of this function are in device init methods, switch the function to do an in-place initialization of a struct that can be embedded in the device state struct of the caller.
This fixes LeakSanitizer leak warnings that have appeared in the patchew configuration (which only tries to run the sanitizers for the x86_64-softmmu target) now that we use the bitbang-i2c code in an x86-64 config.
Message-id: [email protected]
--- hw/display/ati_int.h | 2 +- include/hw/i2c/bitbang_i2c.h | 38 ++++++++++++++++++++++++++++- include/hw/i2c/ppc4xx_i2c.h | 2 +- hw/display/ati.c | 7 +++--- hw/i2c/bitbang_i2c.c | 47 +++--------------------------------- hw/i2c/ppc4xx_i2c.c | 6 ++--- hw/i2c/versatile_i2c.c | 8 +++--- 7 files changed, 53 insertions(+), 57 deletions(-)
hw/display/ati_int.h +1 -1
@@ -88,7 +88,7 @@ typedef struct ATIVGAState {uint16_t cursor_size;uint32_t cursor_offset;QEMUCursor *cursor; -bitbang_i2c_interface *bbi2c; +bitbang_i2c_interface bbi2c;MemoryRegion io;MemoryRegion mm;ATIVGARegs regs;
include/hw/i2c/bitbang_i2c.h +37 -1
@@ -8,7 +8,43 @@ typedef struct bitbang_i2c_interface bitbang_i2c_interface;#define BITBANG_I2C_SDA 0#define BITBANG_I2C_SCL 1 -bitbang_i2c_interface *bitbang_i2c_init (I2CBus *bus); +typedef enum bitbang_i2c_state { +STOPPED =0 , +SENDING_BIT7 , +SENDING_BIT6 , +SENDING_BIT5 , +SENDING_BIT4 , +SENDING_BIT3 , +SENDING_BIT2 , +SENDING_BIT1 , +SENDING_BIT0 , +WAITING_FOR_ACK , +RECEIVING_BIT7 , +RECEIVING_BIT6 , +RECEIVING_BIT5 , +RECEIVING_BIT4 , +RECEIVING_BIT3 , +RECEIVING_BIT2 , +RECEIVING_BIT1 , +RECEIVING_BIT0 , +SENDING_ACK , +SENT_NACK +}bitbang_i2c_state ; + +struct bitbang_i2c_interface { +I2CBus *bus; +bitbang_i2c_state state; +int last_data; +int last_clock; +int device_out; +uint8_t buffer; +int current_addr; +}; + +/** +* bitbang_i2c_init: in-place initialize the bitbang_i2c_interface struct +*/ +void bitbang_i2c_init (bitbang_i2c_interface *s,I2CBus *bus);int bitbang_i2c_set (bitbang_i2c_interface *i2c,int line,int level);#endif
include/hw/i2c/ppc4xx_i2c.h +1 -1
@@ -41,7 +41,7 @@ typedef struct PPC4xxI2CState {I2CBus *bus;qemu_irq irq;MemoryRegion iomem; -bitbang_i2c_interface *bitbang; +bitbang_i2c_interface bitbang;int mdidx;uint8_t mdata[4 ];uint8_t lmadr;
hw/display/ati.c +3 -4
@@ -538,7 +538,7 @@ static void ati_mm_write(void *opaque, hwaddr addr,break ;case GPIO_DVI_DDC :if (s->dev_id !=PCI_DEVICE_ID_ATI_RAGE128_PF ) { - s->regs.gpio_dvi_ddc =ati_i2c (s->bbi2c, data,0 ); + s->regs.gpio_dvi_ddc =ati_i2c (&s->bbi2c, data,0 ); }break ; case GPIO_MONID ... GPIO_MONID + 3:
@@ -554,7 +554,7 @@ static void ati_mm_write(void *opaque, hwaddr addr,*/ if ((s->regs.gpio_monid &BIT (25 )) && addr <=GPIO_MONID +2 && addr + size >GPIO_MONID +2 ) { - s->regs.gpio_monid =ati_i2c (s->bbi2c, s->regs.gpio_monid,1 ); + s->regs.gpio_monid =ati_i2c (&s->bbi2c, s->regs.gpio_monid,1 ); } }break ;
@@ -856,7 +856,7 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)/* ddc, edid */ I2CBus *i2cbus =i2c_init_bus (DEVICE (s),"ati-vga.ddc" ); - s->bbi2c =bitbang_i2c_init (i2cbus); +bitbang_i2c_init (&s->bbi2c, i2cbus);I2CSlave *i2cddc =I2C_SLAVE (qdev_create (BUS (i2cbus),TYPE_I2CDDC ));i2c_set_slave_address (i2cddc,0x50 );
@@ -885,7 +885,6 @@ static void ati_vga_exit(PCIDevice *dev)ATIVGAState *s =ATI_VGA (dev);graphic_console_close (s->vga.con); -g_free (s->bbi2c); }static Property ati_vga_properties[] = {
hw/i2c/bitbang_i2c.c +4 -43
82 lines not on this page · raw message
hw/i2c/ppc4xx_i2c.c +3 -3
@@ -311,9 +311,9 @@ static void ppc4xx_i2c_writeb(void *opaque, hwaddr addr, uint64_t value,case IIC_DIRECTCNTL : i2c->directcntl = value & (IIC_DIRECTCNTL_SDAC &IIC_DIRECTCNTL_SCLC ); i2c->directcntl |= (value &IIC_DIRECTCNTL_SCLC ?1 :0 ); -bitbang_i2c_set (i2c->bitbang,BITBANG_I2C_SCL , +bitbang_i2c_set (&i2c->bitbang,BITBANG_I2C_SCL , i2c->directcntl &IIC_DIRECTCNTL_MSCL ); - i2c->directcntl |=bitbang_i2c_set (i2c->bitbang,BITBANG_I2C_SDA , + i2c->directcntl |=bitbang_i2c_set (&i2c->bitbang,BITBANG_I2C_SDA , (value &IIC_DIRECTCNTL_SDAC ) !=0 ) <<1 ;break ;default :
@@ -347,7 +347,7 @@ static void ppc4xx_i2c_init(Object *o)sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->iomem);sysbus_init_irq (SYS_BUS_DEVICE (s), &s->irq); s->bus =i2c_init_bus (DEVICE (s),"i2c" ); - s->bitbang =bitbang_i2c_init (s->bus); +bitbang_i2c_init (&s->bitbang, s->bus); }static void ppc4xx_i2c_class_init (ObjectClass *klass,void *data)
hw/i2c/versatile_i2c.c +4 -4
@@ -35,7 +35,7 @@ typedef struct VersatileI2CState {SysBusDevice parent_obj;MemoryRegion iomem; -bitbang_i2c_interface *bitbang; +bitbang_i2c_interface bitbang;int out;int in; } VersatileI2CState;
@@ -70,8 +70,8 @@ static void versatile_i2c_write(void *opaque, hwaddr offset,qemu_log_mask (LOG_GUEST_ERROR ,"%s: Bad offset 0x%x\n" , __func__, (int )offset); } -bitbang_i2c_set (s->bitbang,BITBANG_I2C_SCL , (s->out &1 ) !=0 ); - s->in =bitbang_i2c_set (s->bitbang,BITBANG_I2C_SDA , (s->out &2 ) !=0 ); +bitbang_i2c_set (&s->bitbang,BITBANG_I2C_SCL , (s->out &1 ) !=0 ); + s->in =bitbang_i2c_set (&s->bitbang,BITBANG_I2C_SDA , (s->out &2 ) !=0 ); }static const MemoryRegionOps versatile_i2c_ops = {
@@ -88,7 +88,7 @@ static void versatile_i2c_init(Object *obj)I2CBus *bus; bus =i2c_init_bus (dev,"i2c" ); - s->bitbang =bitbang_i2c_init (bus); +bitbang_i2c_init (&s->bitbang, bus);memory_region_init_io (&s->iomem, obj, &versatile_i2c_ops, s,"versatile_i2c" ,0x1000 );sysbus_init_mmio (sbd, &s->iomem);
Signature · 1 line
2.18.1
[Qemu-arm] [PULL 2/4] virtio-gpu: check if the resource already exists in virtio_gpu_load()
In reply to Gerd HoffmannFrom: Li Qiang <[email protected]>
While loading virtio-gpu, the data can be malicious, we should check if the resource already exists.
Message-id: [email protected]
--- hw/display/virtio-gpu.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/display/virtio-gpu.c +5 -0
@@ -1002,6 +1002,11 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size, resource_id =qemu_get_be32 (f);while (resource_id !=0 ) { + res =virtio_gpu_find_resource (g, resource_id); +if (res) { +return -EINVAL ; + } + res = g_new0(struct virtio_gpu_simple_resource, 1); res->resource_id = resource_id; res->width =qemu_get_be32 (f);
Signature · 1 line
2.18.1
[Qemu-arm] [PULL 4/4] Add ati vgabios to INSTALL_BLOBS.
In reply to Gerd HoffmannMessage-id: [email protected]
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -750,7 +750,7 @@ bepo cz ifdef INSTALL_BLOBS BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \ vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \ -vgabios-ramfb.bin vgabios-bochs-display.bin \ +vgabios-ramfb.bin vgabios-bochs-display.bin vgabios-ati.bin \ ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \ pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \ pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
Signature · 1 line
2.18.1
[Qemu-arm] [PULL 1/4] virtio-gpu: fix unmap in error path
In reply to Gerd HoffmannWe land here in case not everything we've asked for could be mapped. So unmap only the bytes which have actually been mapped.
Also we didn't access anything, so acces_len can be 0.
Message-id: [email protected]
--- hw/display/virtio-gpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/display/virtio-gpu.c +2 -2
@@ -1048,9 +1048,9 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,if (res->iov[i].iov_base) {dma_memory_unmap (VIRTIO_DEVICE (g)->dma_as, res->iov[i].iov_base, - res->iov[i].iov_len, + len,DMA_DIRECTION_TO_DEVICE , - res->iov[i].iov_len); +0 ); }/* ...and the mappings for previous loop iterations */ res->iov_cnt = i;
Signature · 1 line
2.18.1
Peter Maydell
AppliedQuoted 7 lines · Gerd Hoffmann
The following changes since commit
506179e42112be77bfd071f050b15762d3b2cd43:Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.1-20190702' into staging (2019-07-02 18:56:44 +0100)
are available in the Git repository at:
Quoted 9 lines
git://git.kraxel.org/qemutags/vga-20190703-pull-requestfor you to fetch changes up to
0a87fd693d4e955a6877a2166b65bb7b7192aaaa:Add ati vgabios to
INSTALL_BLOBS. (2019-07-03 10:52:15 +0200)----------------------------------------------------------------
vga: virtio fixes, bitbang i2c asan fix, install ati vgabios.
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.
-- PMM
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 0/4] Vga 20190703 patches
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
c204e34..f0577c6 master -> master
- [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
=== OUTPUT BEGIN ===
checkpatch.pl: no revisions returned for revlist '1' === OUTPUT END ===
Test command exited with code: 255
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 0/4] Vga 20190703 patches
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
=== OUTPUT BEGIN ===
checkpatch.pl: no revisions returned for revlist '1' === OUTPUT END ===
Test command exited with code: 255
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 0/4] Vga 20190703 patches
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
=== OUTPUT BEGIN ===
checkpatch.pl: no revisions returned for revlist '1' === OUTPUT END ===
Test command exited with code: 255
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]