linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arch@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@vger.kernel.org,
	Russell King <rmk+kernel@armlinux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	kernel-build-reports@lists.linaro.org,
	kvmarm@lists.cs.columbia.edu, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 02/13] KVM: arm: fix gcc-4.5 build
Date: Fri, 16 Dec 2016 11:56:23 +0100	[thread overview]
Message-ID: <20161216105634.235457-3-arnd@arndb.de> (raw)
Message-ID: <20161216105623.DsVQlEB2DcYEfHregrymt7p8CZsEub-gl7HXZayKJTM@z> (raw)
In-Reply-To: <20161216105634.235457-1-arnd@arndb.de>

Old gcc versions cannot used named initializers for anonymous
unions, leading to a build failure here. This replaces the anonymous
union with a named one, which allows us to build with at least gcc-4.3
through 4.5. Versions 4.6 and higher are fine without this.

virt/kvm/arm/vgic/vgic-mmio-v2.c:295: error: unknown field 'read' specified in initializer
virt/kvm/arm/vgic/vgic-mmio-v2.c:295: warning: missing braces around initializer
virt/kvm/arm/vgic/vgic-mmio-v2.c:295: warning: (near initialization for 'vgic_v2_dist_registers[0].<anonymous>')
virt/kvm/arm/vgic/vgic-mmio-v2.c:295: error: unknown field 'write' specified in initializer
virt/kvm/arm/vgic/vgic-mmio-v2.c:298: error: unknown field 'read' specified in initializer

Fixes: 59c5ab40989a ("KVM: arm64: vgic-its: Introduce ITS emulation file with MMIO framework")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 virt/kvm/arm/vgic/vgic-its.c     |  4 ++--
 virt/kvm/arm/vgic/vgic-mmio-v3.c |  8 ++++----
 virt/kvm/arm/vgic/vgic-mmio.c    | 16 ++++++++--------
 virt/kvm/arm/vgic/vgic-mmio.h    | 12 ++++++------
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
index 8c2b3cdcb2c5..922d820e2646 100644
--- a/virt/kvm/arm/vgic/vgic-its.c
+++ b/virt/kvm/arm/vgic/vgic-its.c
@@ -1292,8 +1292,8 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm,
 	.reg_offset = off,					\
 	.len = length,						\
 	.access_flags = acc,					\
-	.its_read = rd,						\
-	.its_write = wr,					\
+	.r.its_read = rd,						\
+	.w.its_write = wr,					\
 }
 
 static void its_mmio_write_wi(struct kvm *kvm, struct vgic_its *its,
diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c
index 50f42f0f8c4f..aa31110e4ebd 100644
--- a/virt/kvm/arm/vgic/vgic-mmio-v3.c
+++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c
@@ -362,15 +362,15 @@ static void vgic_mmio_write_pendbase(struct kvm_vcpu *vcpu,
 		.bits_per_irq = bpi,					\
 		.len = (bpi * VGIC_NR_PRIVATE_IRQS) / 8,		\
 		.access_flags = acc,					\
-		.read = vgic_mmio_read_raz,				\
-		.write = vgic_mmio_write_wi,				\
+		.r.read = vgic_mmio_read_raz,				\
+		.w.write = vgic_mmio_write_wi,				\
 	}, {								\
 		.reg_offset = off + (bpi * VGIC_NR_PRIVATE_IRQS) / 8,	\
 		.bits_per_irq = bpi,					\
 		.len = (bpi * (1024 - VGIC_NR_PRIVATE_IRQS)) / 8,	\
 		.access_flags = acc,					\
-		.read = rd,						\
-		.write = wr,						\
+		.r.read = rd,						\
+		.w.write = wr,						\
 	}
 
 static const struct vgic_register_region vgic_v3_dist_registers[] = {
diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c
index ebe1b9fa3c4d..6690922bc6b0 100644
--- a/virt/kvm/arm/vgic/vgic-mmio.c
+++ b/virt/kvm/arm/vgic/vgic-mmio.c
@@ -500,16 +500,16 @@ static int dispatch_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,
 
 	switch (iodev->iodev_type) {
 	case IODEV_CPUIF:
-		data = region->read(vcpu, addr, len);
+		data = region->r.read(vcpu, addr, len);
 		break;
 	case IODEV_DIST:
-		data = region->read(vcpu, addr, len);
+		data = region->r.read(vcpu, addr, len);
 		break;
 	case IODEV_REDIST:
-		data = region->read(iodev->redist_vcpu, addr, len);
+		data = region->r.read(iodev->redist_vcpu, addr, len);
 		break;
 	case IODEV_ITS:
-		data = region->its_read(vcpu->kvm, iodev->its, addr, len);
+		data = region->r.its_read(vcpu->kvm, iodev->its, addr, len);
 		break;
 	}
 
@@ -531,16 +531,16 @@ static int dispatch_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,
 
 	switch (iodev->iodev_type) {
 	case IODEV_CPUIF:
-		region->write(vcpu, addr, len, data);
+		region->w.write(vcpu, addr, len, data);
 		break;
 	case IODEV_DIST:
-		region->write(vcpu, addr, len, data);
+		region->w.write(vcpu, addr, len, data);
 		break;
 	case IODEV_REDIST:
-		region->write(iodev->redist_vcpu, addr, len, data);
+		region->w.write(iodev->redist_vcpu, addr, len, data);
 		break;
 	case IODEV_ITS:
-		region->its_write(vcpu->kvm, iodev->its, addr, len, data);
+		region->w.its_write(vcpu->kvm, iodev->its, addr, len, data);
 		break;
 	}
 
diff --git a/virt/kvm/arm/vgic/vgic-mmio.h b/virt/kvm/arm/vgic/vgic-mmio.h
index 84961b4e4422..7f7da7239612 100644
--- a/virt/kvm/arm/vgic/vgic-mmio.h
+++ b/virt/kvm/arm/vgic/vgic-mmio.h
@@ -26,14 +26,14 @@ struct vgic_register_region {
 				      unsigned int len);
 		unsigned long (*its_read)(struct kvm *kvm, struct vgic_its *its,
 					  gpa_t addr, unsigned int len);
-	};
+	} r;
 	union {
 		void (*write)(struct kvm_vcpu *vcpu, gpa_t addr,
 			      unsigned int len, unsigned long val);
 		void (*its_write)(struct kvm *kvm, struct vgic_its *its,
 				  gpa_t addr, unsigned int len,
 				  unsigned long val);
-	};
+	} w;
 };
 
 extern struct kvm_io_device_ops kvm_io_gic_ops;
@@ -72,8 +72,8 @@ extern struct kvm_io_device_ops kvm_io_gic_ops;
 		.bits_per_irq = bpi,					\
 		.len = bpi * 1024 / 8,					\
 		.access_flags = acc,					\
-		.read = rd,						\
-		.write = wr,						\
+		.r.read = rd,						\
+		.w.write = wr,						\
 	}
 
 #define REGISTER_DESC_WITH_LENGTH(off, rd, wr, length, acc)		\
@@ -82,8 +82,8 @@ extern struct kvm_io_device_ops kvm_io_gic_ops;
 		.bits_per_irq = 0,					\
 		.len = length,						\
 		.access_flags = acc,					\
-		.read = rd,						\
-		.write = wr,						\
+		.r.read = rd,						\
+		.w.write = wr,						\
 	}
 
 int kvm_vgic_register_mmio_region(struct kvm *kvm, struct kvm_vcpu *vcpu,
-- 
2.9.0


  parent reply	other threads:[~2016-12-16 10:57 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-16 10:56 [RFC] minimum gcc version for kernel: raise to gcc-4.3 or 4.6? Arnd Bergmann
2016-12-16 10:56 ` Arnd Bergmann
2016-12-16 10:56 ` [PATCH 01/13] [HACK] gcc-4.5: avoid link errors for unused function pointers Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 10:56 ` Arnd Bergmann [this message]
2016-12-16 10:56   ` [PATCH 02/13] KVM: arm: fix gcc-4.5 build Arnd Bergmann
2017-01-04 10:38   ` Christoffer Dall
2017-01-04 10:38     ` Christoffer Dall
2016-12-16 10:56 ` [PATCH 03/13] ARM: div64: fix building with gcc-4.5 and lower Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 10:56 ` [PATCH 04/13] vfio-pci: use 32-bit comparisons for register address for gcc-4.5 Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 15:30   ` Alex Williamson
2016-12-16 19:50     ` Arnd Bergmann
2016-12-16 10:56 ` [PATCH 05/13] clk: pxa: fix gcc-4.4 build Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 10:56 ` [PATCH 06/13] ARM: atomic: " Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 10:56 ` [PATCH 07/13] watchdog: kempld: fix gcc-4.3 build Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 10:56 ` [PATCH 08/13] arm/arm64: xen: avoid gcc-4.4 warning Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 10:56 ` [PATCH 09/13] ARM: mark cmpxchg and xchg __always_inline for gcc-4.3 Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 10:56 ` [PATCH 10/13] asm-generic: mark cmpxchg as " Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 10:56 ` [PATCH 11/13] fs: fix unsigned enum warning with gcc-4.2 Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2017-01-03 22:47   ` Brendan Gregg
2017-02-28 21:53     ` Brendan Gregg
2016-12-16 10:56 ` [PATCH 12/13] KVM: arm: avoid binary number literals for gcc-4.2 Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2017-01-04 10:39   ` Christoffer Dall
2017-01-04 10:39     ` Christoffer Dall
2016-12-16 10:56 ` [PATCH 13/13] ARM: avoid 'Q' asm constraint for gcc-4.1 and earlier Arnd Bergmann
2016-12-16 10:56   ` Arnd Bergmann
2016-12-16 11:14 ` [RFC] minimum gcc version for kernel: raise to gcc-4.3 or 4.6? Arnd Bergmann
2016-12-16 11:14   ` Arnd Bergmann
2017-04-16 19:52   ` Kees Cook
2017-04-20 10:15     ` Arnd Bergmann
2017-04-20 19:52       ` Kees Cook
2017-04-20 19:52         ` Kees Cook
2017-04-21 20:55         ` Arnd Bergmann
2017-04-21 20:55           ` Arnd Bergmann
2017-04-21 21:05           ` Kees Cook
2017-04-21 21:05             ` Kees Cook
2017-04-22  3:10             ` Maciej W. Rozycki
2017-04-22  3:10               ` Maciej W. Rozycki
2017-04-22 15:30               ` Arnd Bergmann
2017-04-22 15:30                 ` Arnd Bergmann
2017-04-23 20:13                 ` Geert Uytterhoeven
2017-04-23 20:13                   ` Geert Uytterhoeven
2017-04-24  9:44                   ` Arnd Bergmann
2017-04-24  9:44                     ` Arnd Bergmann
2017-04-24 10:17                     ` Geert Uytterhoeven
2017-04-24 10:17                       ` Geert Uytterhoeven
2017-04-24 14:13                       ` Arnd Bergmann
2017-04-24 16:53                     ` Maciej W. Rozycki
2017-04-24 17:29                       ` Arnd Bergmann
2017-04-24 18:16                         ` Geert Uytterhoeven
2017-04-24 18:16                           ` Geert Uytterhoeven
2017-04-24 18:30                         ` Maciej W. Rozycki
2017-04-24 18:30                           ` Maciej W. Rozycki
2017-04-24 20:30                           ` Arnd Bergmann
2017-04-24 20:52                             ` Kees Cook
2017-04-25  7:06                               ` Geert Uytterhoeven
2017-04-25  7:06                                 ` Geert Uytterhoeven
2017-04-25  9:22     ` Suzuki K Poulose
2017-04-25  9:22       ` Suzuki K Poulose
2016-12-16 15:54 ` Geert Uytterhoeven
2016-12-16 15:54   ` Geert Uytterhoeven
2016-12-16 19:58   ` Arnd Bergmann
2016-12-16 19:58     ` Arnd Bergmann
2016-12-16 20:34     ` Geert Uytterhoeven
2016-12-16 20:34       ` Geert Uytterhoeven
2016-12-16 17:00 ` Sebastian Andrzej Siewior
2016-12-16 22:00   ` Arnd Bergmann
2016-12-16 22:00     ` Arnd Bergmann
2016-12-17 11:29     ` Sebastian Andrzej Siewior
2016-12-17 11:29       ` Sebastian Andrzej Siewior
2017-01-02 12:23       ` Russell King - ARM Linux
2017-01-02 12:23         ` Russell King - ARM Linux
2016-12-20  9:59     ` Heiko Carstens
2016-12-20  9:59       ` Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161216105634.235457-3-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-build-reports@lists.linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).