Skip to contentSkip to conversation

Ide patches

GIT PULL Applied John Snow 3 participants 8 messages Jul 18, 2017 – Jul 19, 2017

lore
Share & tools
lore

John Snow

author
#0 lore raw

The following changes since commit 368e708b4c95501574ab11632c7a0b8bb3ddc7e8:

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging (2017-07-18 15:24:11 +0100)

are available in the git repository at:

https://github.com/jnsnow/qemu.git tags/ide-pull-request

for you to fetch changes up to ff0ca962345ecdb87c331888a806cde49936fd9f:

tests/ahci-test: Be mean with RAM (2017-07-18 11:47:57 -0400)

----------------------------------------------------------------

----------------------------------------------------------------

Dr. David Alan Gilbert (1):
tests/ahci-test: Be mean with RAM

John Snow (3):
ahci: add ahci_get_num_ports
ahci: Isolate public AHCI interface
ahci: split public and private interface

 hw/i386/pc_q35.c       |   4 +-
 hw/ide/ahci.c          |  10 +-
 hw/ide/ahci_internal.h | 359 +++++++++++++++++++++++++++++++++++++++++++++++++
 hw/ide/ich.c           |   2 +-
 hw/mips/boston.c       |   4 +-
 include/hw/ide/ahci.h  | 320 +------------------------------------------
 tests/ahci-test.c      |   8 +-
 7 files changed, 380 insertions(+), 327 deletions(-)
 create mode 100644 hw/ide/ahci_internal.h
Signature · 1 line
2.9.4
author
#1 lore raw

[Qemu-devel] [PULL 1/4] ahci: add ahci_get_num_ports

Instead of reaching into the PCI state, allow the AHCIDevice to respond with how many ports it has.

Message-id: [email protected]

---
 hw/i386/pc_q35.c      | 4 ++--
 hw/ide/ahci.c         | 8 ++++++++
 hw/mips/boston.c      | 4 ++--
 include/hw/ide/ahci.h | 1 +
 4 files changed, 13 insertions(+), 4 deletions(-)
hw/i386/pc_q35.c +2 -2
index 1653a47..169a214 100644
@@ -242,8 +242,8 @@ static void pc_q35_init(MachineState *machine)
                                                true, "ich9-ahci");
         idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0");
         idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
-        g_assert(MAX_SATA_PORTS == ICH_AHCI(ahci)->ahci.ports);
-        ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports);
+        g_assert(MAX_SATA_PORTS == ahci_get_num_ports(ahci));
+        ide_drive_get(hd, ahci_get_num_ports(ahci));
         ahci_ide_create_devs(ahci, hd);
     } else {
         idebus[0] = idebus[1] = NULL;
hw/ide/ahci.c +8 -0
index 874d3fe..e3cdbc8 100644
@@ -1833,6 +1833,14 @@ static void sysbus_ahci_register_types(void)
 
 type_init(sysbus_ahci_register_types)
 
+int32_t ahci_get_num_ports(PCIDevice *dev)
+{
+    AHCIPCIState *d = ICH_AHCI(dev);
+    AHCIState *ahci = &d->ahci;
+
+    return ahci->ports;
+}
+
 void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd)
 {
     AHCIPCIState *d = ICH_AHCI(dev);
hw/mips/boston.c +2 -2
index 7985c60..776ee28 100644
@@ -538,8 +538,8 @@ static void boston_mach_init(MachineState *machine)
     ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
                                            PCI_DEVFN(0, 0),
                                            true, TYPE_ICH9_AHCI);
-    g_assert(ARRAY_SIZE(hd) == ICH_AHCI(ahci)->ahci.ports);
-    ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports);
+    g_assert(ARRAY_SIZE(hd) == ahci_get_num_ports(ahci));
+    ide_drive_get(hd, ahci_get_num_ports(ahci));
     ahci_ide_create_devs(ahci, hd);
 
     if (machine->firmware) {
include/hw/ide/ahci.h +1 -0
index 0ca7c65..f866bbf 100644
@@ -372,6 +372,7 @@ void ahci_uninit(AHCIState *s);
 
 void ahci_reset(AHCIState *s);
 
+int32_t ahci_get_num_ports(PCIDevice *dev);
 void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd);
 
 #define TYPE_SYSBUS_AHCI "sysbus-ahci"
Signature · 1 line
2.9.4
author
#2 lore raw

[Qemu-devel] [PULL 2/4] ahci: Isolate public AHCI interface

In reply to John Snow

Begin separating the public/private interface by removing the minimum set of information used by code outside of hw/ide/ and calling this a new ahci_public.h file, which will be renamed to ahci.h in a future patch.

Message-id: [email protected]

---
 include/hw/ide/ahci.h        | 57 +++------------------------
 include/hw/ide/ahci_public.h | 91 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+), 52 deletions(-)
 create mode 100644 include/hw/ide/ahci_public.h
include/hw/ide/ahci.h +5 -52
index f866bbf..70a0140 100644
@@ -21,9 +21,10 @@
  *
  */
 
-#ifndef HW_IDE_AHCI_H
-#define HW_IDE_AHCI_H
+#ifndef HW_IDE_AHCI_INTERNAL_H
+#define HW_IDE_AHCI_INTERNAL_H
 
+#include "hw/ide/ahci_public.h"
 #include "hw/sysbus.h"
 
 #define AHCI_MEM_BAR_SIZE         0x1000
@@ -210,14 +211,6 @@
 #define SATA_CAP_REV            0x2
 #define SATA_CAP_BAR            0x4
 
-typedef struct AHCIControlRegs {
-    uint32_t    cap;
-    uint32_t    ghc;
-    uint32_t    irqstatus;
-    uint32_t    impl;
-    uint32_t    version;
-} AHCIControlRegs;
-
 typedef struct AHCIPortRegs {
     uint32_t    lst_addr;
     uint32_t    lst_addr_hi;
@@ -251,8 +244,6 @@ typedef struct AHCI_SG {
     uint32_t    flags_size;
 } QEMU_PACKED AHCI_SG;
 
-typedef struct AHCIDevice AHCIDevice;
-
 typedef struct NCQTransferState {
     AHCIDevice *drive;
     BlockAIOCB *aiocb;
@@ -286,27 +277,13 @@ struct AHCIDevice {
     NCQTransferState ncq_tfs[AHCI_MAX_CMDS];
 };
 
-typedef struct AHCIState {
-    DeviceState *container;
-
-    AHCIDevice *dev;
-    AHCIControlRegs control_regs;
-    MemoryRegion mem;
-    MemoryRegion idp;       /* Index-Data Pair I/O port space */
-    unsigned idp_offset;    /* Offset of index in I/O port space */
-    uint32_t idp_index;     /* Current IDP index */
-    int32_t ports;
-    qemu_irq irq;
-    AddressSpace *as;
-} AHCIState;
-
-typedef struct AHCIPCIState {
+struct AHCIPCIState {
     /*< private >*/
     PCIDevice parent_obj;
     /*< public >*/
 
     AHCIState ahci;
-} AHCIPCIState;
+};
 
 #define TYPE_ICH9_AHCI "ich9-ahci"
 
@@ -372,35 +349,11 @@ void ahci_uninit(AHCIState *s);
 
 void ahci_reset(AHCIState *s);
 
-int32_t ahci_get_num_ports(PCIDevice *dev);
-void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd);
-
 #define TYPE_SYSBUS_AHCI "sysbus-ahci"
 #define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
 
-typedef struct SysbusAHCIState {
-    /*< private >*/
-    SysBusDevice parent_obj;
-    /*< public >*/
-
-    AHCIState ahci;
-    uint32_t num_ports;
-} SysbusAHCIState;
-
 #define TYPE_ALLWINNER_AHCI "allwinner-ahci"
 #define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
                        TYPE_ALLWINNER_AHCI)
 
-#define ALLWINNER_AHCI_MMIO_OFF  0x80
-#define ALLWINNER_AHCI_MMIO_SIZE 0x80
-
-struct AllwinnerAHCIState {
-    /*< private >*/
-    SysbusAHCIState parent_obj;
-    /*< public >*/
-
-    MemoryRegion mmio;
-    uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4];
-};
-
 #endif /* HW_IDE_AHCI_H */
include/hw/ide/ahci_public.h new file +91 -0

91 lines not on this page · raw message

Signature · 1 line
2.9.4
author
#3 lore raw

[Qemu-devel] [PULL 3/4] ahci: split public and private interface

In reply to John Snow

Complete the split by renaming ahci_public.h --> ahci.h and moving the current ahci.h to hw/ide/ahci_internal.h.

Adjust ahci_internal.h to now load ahci.h instead of ahci_public.h.

Finalize the split by switching external users to the new header.

Message-id: [email protected]

---
 hw/ide/ahci.c                |   2 +-
 hw/ide/ahci_internal.h       | 359 +++++++++++++++++++++++++++++++++++++++++
 hw/ide/ich.c                 |   2 +-
 include/hw/ide/ahci.h        | 368 ++++++-------------------------------------
 include/hw/ide/ahci_public.h |  91 -----------
 5 files changed, 411 insertions(+), 411 deletions(-)
 create mode 100644 hw/ide/ahci_internal.h
 delete mode 100644 include/hw/ide/ahci_public.h
hw/ide/ahci.c +1 -1
index e3cdbc8..406a1b5 100644
@@ -32,7 +32,7 @@
 #include "sysemu/dma.h"
 #include "hw/ide/internal.h"
 #include "hw/ide/pci.h"
-#include "hw/ide/ahci.h"
+#include "hw/ide/ahci_internal.h"
 
 #define DEBUG_AHCI 0
 
hw/ide/ahci_internal.h new file +359 -0

359 lines not on this page · raw message

hw/ide/ich.c +1 -1
index 989fca5..9472a60 100644
@@ -69,7 +69,7 @@
 #include "sysemu/block-backend.h"
 #include "sysemu/dma.h"
 #include "hw/ide/pci.h"
-#include "hw/ide/ahci.h"
+#include "hw/ide/ahci_internal.h"
 
 #define ICH9_MSI_CAP_OFFSET     0x80
 #define ICH9_SATA_CAP_OFFSET    0xA8
include/hw/ide/ahci.h +50 -318

389 lines not on this page · raw message

include/hw/ide/ahci_public.h deleted +0 -91

91 lines not on this page · raw message

Signature · 1 line
2.9.4
author
#4 lore raw

[Qemu-devel] [PULL 4/4] tests/ahci-test: Be mean with RAM

In reply to John Snow

From: "Dr. David Alan Gilbert" <[email protected]>

The migration tests used two VMs each with -m 1024 this caused problems when run in some small, pessimistic test VMs (netbsd). We can just be meaner with the amount of RAM in the test and use -m 384

Message-id: [email protected]

---
 tests/ahci-test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/ahci-test.c +4 -4
index ef17629..999121b 100644
@@ -1132,9 +1132,9 @@ static void test_migrate_sanity(void)
     AHCIQState *src, *dst;
     char *uri = g_strdup_printf("unix:%s", mig_socket);
 
-    src = ahci_boot("-m 1024 -M q35 "
+    src = ahci_boot("-m 384 -M q35 "
                     "-drive if=ide,file=%s,format=%s ", tmp_path, imgfmt);
-    dst = ahci_boot("-m 1024 -M q35 "
+    dst = ahci_boot("-m 384 -M q35 "
                     "-drive if=ide,file=%s,format=%s "
                     "-incoming %s", tmp_path, imgfmt, uri);
 
@@ -1157,10 +1157,10 @@ static void ahci_migrate_simple(uint8_t cmd_read, uint8_t cmd_write)
     unsigned char *rx = g_malloc0(bufsize);
     char *uri = g_strdup_printf("unix:%s", mig_socket);
 
-    src = ahci_boot_and_enable("-m 1024 -M q35 "
+    src = ahci_boot_and_enable("-m 384 -M q35 "
                                "-drive if=ide,format=%s,file=%s ",
                                imgfmt, tmp_path);
-    dst = ahci_boot("-m 1024 -M q35 "
+    dst = ahci_boot("-m 384 -M q35 "
                     "-drive if=ide,format=%s,file=%s "
                     "-incoming %s", imgfmt, tmp_path, uri);
 
Signature · 1 line
2.9.4
#5 lore raw
In reply to John Snow
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PULL 0/4] Ide patches
Message-id: [email protected]
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
02dcdb3 tests/ahci-test: Be mean with RAM
e94eb50 ahci: split public and private interface
cb2c639 ahci: Isolate public AHCI interface
d77a741 ahci: add ahci_get_num_ports

=== OUTPUT BEGIN ===
Checking PATCH 1/4: ahci: add ahci_get_num_ports... Checking PATCH 2/4: ahci: Isolate public AHCI interface...
ERROR: spaces required around that '/' (ctx:VxV) #221: FILE: include/hw/ide/ahci_public.h:88:

+    uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4];
                                           ^

total: 1 errors, 0 warnings, 189 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 3/4: ahci: split public and private interface...
ERROR: spaces required around that '/' (ctx:VxV) #800: FILE: include/hw/ide/ahci.h:88:

+    uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4];
                                           ^

total: 1 errors, 0 warnings, 760 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 4/4: tests/ahci-test: Be mean with RAM... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

author
#6 lore raw
Quoted 69 lines · On 07/18/2017 05:27 PM, [email protected] wrote:

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PULL 0/4] Ide patches
Message-id: [email protected]
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
02dcdb3 tests/ahci-test: Be mean with RAM
e94eb50 ahci: split public and private interface
cb2c639 ahci: Isolate public AHCI interface
d77a741 ahci: add ahci_get_num_ports

=== OUTPUT BEGIN ===
Checking PATCH 1/4: ahci: add ahci_get_num_ports... Checking PATCH 2/4: ahci: Isolate public AHCI interface...
ERROR: spaces required around that '/' (ctx:VxV) #221: FILE: include/hw/ide/ahci_public.h:88:

+    uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4];
                                           ^

total: 1 errors, 0 warnings, 189 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 3/4: ahci: split public and private interface...
ERROR: spaces required around that '/' (ctx:VxV) #800: FILE: include/hw/ide/ahci.h:88:

+    uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4];
                                           ^

total: 1 errors, 0 warnings, 760 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 4/4: tests/ahci-test: Be mean with RAM... === OUTPUT END ===

Quoted 7 lines

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

IMO, false positive on code movement, but I could fix this up if desired.

--js

#7 lore raw
In reply to John Snow
Quoted 16 lines · John Snow

The following changes since commit 368e708b4c95501574ab11632c7a0b8bb3ddc7e8:

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging (2017-07-18 15:24:11 +0100)

are available in the git repository at:

https://github.com/jnsnow/qemu.git tags/ide-pull-request

for you to fetch changes up to ff0ca962345ecdb87c331888a806cde49936fd9f:

tests/ahci-test: Be mean with RAM (2017-07-18 11:47:57 -0400)

----------------------------------------------------------------

----------------------------------------------------------------

Quoted 7 lines

Dr. David Alan Gilbert (1):
tests/ahci-test: Be mean with RAM

John Snow (3):
ahci: add ahci_get_num_ports
ahci: Isolate public AHCI interface
ahci: split public and private interface

Applied, thanks.

-- PMM