[PATCH] Allow PPC64 to build without virtual IO

Stephen Rothwell sfr at canb.auug.org.au
Tue May 4 17:28:36 EST 2004


Hi all,

This patch allows PPC64 to build without any virtual IO support
at all.  Especially useful for PMAC.

If there are no objections, could someone please add this to Ameslab?
--
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/Kconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/Kconfig
--- ppc64-linux-2.5.for-ames.1/arch/ppc64/Kconfig	2004-05-01 06:04:31.000000000 +1000
+++ ppc64-linux-2.5.for-ames.2/arch/ppc64/Kconfig	2004-05-04 16:51:39.000000000 +1000
@@ -90,6 +90,14 @@
 	bool "Apple PowerMac G5 support"
 	select ADB_PMU

+config PPC_VIO
+	bool "Support for virtual I/O devices"
+	default y if !PPC_PMAC
+	help
+	  Some platforms support virtual devices implemented by the
+	  HyperVisor. This should usually be selected for pSeries or
+	  iSeries machines.
+
 config PPC_SPLPAR
 	depends on PPC_PSERIES
 	bool "Support for shared-processor logical partitions"
@@ -311,7 +319,7 @@
 source "fs/Kconfig"

 menu "iSeries device drivers"
-	depends on PPC_ISERIES
+	depends on PPC_ISERIES && PPC_VIO

 config VIOCONS
 	tristate "iSeries Virtual Console Support"
diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/g5_defconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/g5_defconfig
--- ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/g5_defconfig	2004-04-19 22:05:21.000000000 +1000
+++ ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/g5_defconfig	2004-05-04 16:53:00.000000000 +1000
@@ -61,6 +61,7 @@
 CONFIG_PPC_OF=y
 CONFIG_ALTIVEC=y
 CONFIG_PPC_PMAC=y
+# CONFIG_PPC_VIO is not set
 CONFIG_PMAC_DART=y
 CONFIG_PPC_PMAC64=y
 CONFIG_BOOTX_TEXT=y
diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/iSeries_defconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/iSeries_defconfig
--- ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/iSeries_defconfig	2004-03-19 13:04:41.000000000 +1100
+++ ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/iSeries_defconfig	2004-05-04 16:57:36.000000000 +1000
@@ -56,6 +56,7 @@
 # CONFIG_PPC_PSERIES is not set
 CONFIG_PPC=y
 CONFIG_PPC64=y
+CONFIG_PPC_VIO=y
 # CONFIG_POWER4_ONLY is not set
 # CONFIG_IOMMU_VMERGE is not set
 CONFIG_SMP=y
diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/pSeries_defconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/pSeries_defconfig
--- ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/pSeries_defconfig	2004-04-16 01:05:00.000000000 +1000
+++ ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/pSeries_defconfig	2004-05-04 16:54:15.000000000 +1000
@@ -59,6 +59,7 @@
 CONFIG_PPC_OF=y
 CONFIG_ALTIVEC=y
 # CONFIG_PPC_PMAC is not set
+CONFIG_PPC_VIO=y
 # CONFIG_BOOTX_TEXT is not set
 # CONFIG_POWER4_ONLY is not set
 # CONFIG_IOMMU_VMERGE is not set
diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/defconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/defconfig
--- ppc64-linux-2.5.for-ames.1/arch/ppc64/defconfig	2004-04-16 01:05:00.000000000 +1000
+++ ppc64-linux-2.5.for-ames.2/arch/ppc64/defconfig	2004-05-04 16:52:24.000000000 +1000
@@ -59,6 +59,7 @@
 CONFIG_PPC_OF=y
 CONFIG_ALTIVEC=y
 # CONFIG_PPC_PMAC is not set
+CONFIG_PPC_VIO=y
 # CONFIG_BOOTX_TEXT is not set
 # CONFIG_POWER4_ONLY is not set
 # CONFIG_IOMMU_VMERGE is not set
diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/kernel/Makefile ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/Makefile
--- ppc64-linux-2.5.for-ames.1/arch/ppc64/kernel/Makefile	2004-04-14 05:04:38.000000000 +1000
+++ ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/Makefile	2004-05-04 16:17:57.000000000 +1000
@@ -11,7 +11,7 @@
 			udbg.o binfmt_elf32.o sys_ppc32.o ioctl32.o \
 			ptrace32.o signal32.o rtc.o init_task.o \
 			lmb.o cputable.o cpu_setup_power4.o idle_power4.o \
-			iommu.o sysfs.o vio.o
+			iommu.o sysfs.o

 obj-$(CONFIG_PPC_OF) +=	of_device.o

@@ -42,6 +42,7 @@
 obj-$(CONFIG_MODULES)		+= module.o ppc_ksyms.o
 obj-$(CONFIG_PPC_RTAS)		+= rtas-proc.o
 obj-$(CONFIG_SCANLOG)		+= scanlog.o
+obj-$(CONFIG_PPC_VIO)		+= vio.o
 obj-$(CONFIG_VIOPATH)		+= viopath.o
 obj-$(CONFIG_LPARCFG)		+= lparcfg.o
 obj-$(CONFIG_PPC_VPURR)		+= vpurr.o
diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/kernel/dma.c ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/dma.c
--- ppc64-linux-2.5.for-ames.1/arch/ppc64/kernel/dma.c	2004-04-13 18:06:15.000000000 +1000
+++ ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/dma.c	2004-05-04 17:26:54.000000000 +1000
@@ -5,6 +5,7 @@
  * the pci and vio busses
  */

+#include <linux/config.h>
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 /* Include the busses we support */
@@ -13,11 +14,22 @@
 #include <asm/scatterlist.h>
 #include <asm/bug.h>

+#ifdef CONFIG_PCI
+#define IS_PCI_DEV(dev)		((dev)->bus == &pci_bus_type)
+#else
+#define IS_PCI_DEV(dev)		0
+#endif
+#ifdef CONFIG_PPC_VIO
+#define IS_VIO_DEV(dev)		((dev)->bus == &vio_bus_type)
+#else
+#define IS_VIO_DEV(dev)		0
+#endif
+
 int dma_supported(struct device *dev, u64 mask)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		return pci_dma_supported(to_pci_dev(dev), mask);
-	if (dev->bus == &vio_bus_type)
+	if (IS_VIO_DEV(dev))
 		return vio_dma_supported(to_vio_dev(dev), mask);
 	BUG();
 	return 0;
@@ -26,9 +38,9 @@

 int dma_set_mask(struct device *dev, u64 dma_mask)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
-	if (dev->bus == &vio_bus_type)
+	if (IS_VIO_DEV(dev))
 		return vio_set_dma_mask(to_vio_dev(dev), dma_mask);
 	BUG();
 	return 0;
@@ -38,9 +50,9 @@
 void *dma_alloc_coherent(struct device *dev, size_t size,
 		dma_addr_t *dma_handle, int flag)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
-	if (dev->bus == &vio_bus_type)
+	if (IS_VIO_DEV(dev))
 		return vio_alloc_consistent(to_vio_dev(dev), size, dma_handle);
 	BUG();
 	return 0;
@@ -50,9 +62,9 @@
 void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
 		dma_addr_t dma_handle)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
-	else if (dev->bus == &vio_bus_type)
+	else if (IS_VIO_DEV(dev))
 		vio_free_consistent(to_vio_dev(dev), size, cpu_addr, dma_handle);
 	else
 		BUG();
@@ -62,9 +74,9 @@
 dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
-	if (dev->bus == &vio_bus_type)
+	if (IS_VIO_DEV(dev))
 		return vio_map_single(to_vio_dev(dev), cpu_addr, size, direction);
 	BUG();
 	return (dma_addr_t)0;
@@ -74,9 +86,9 @@
 void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
-	else if (dev->bus == &vio_bus_type)
+	else if (IS_VIO_DEV(dev))
 		vio_unmap_single(to_vio_dev(dev), dma_addr, size, direction);
 	else
 		BUG();
@@ -87,9 +99,9 @@
 		unsigned long offset, size_t size,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
-	if (dev->bus == &vio_bus_type)
+	if (IS_VIO_DEV(dev))
 		return vio_map_page(to_vio_dev(dev), page, offset, size, direction);
 	BUG();
 	return (dma_addr_t)0;
@@ -99,9 +111,9 @@
 void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
-	else if (dev->bus == &vio_bus_type)
+	else if (IS_VIO_DEV(dev))
 		vio_unmap_page(to_vio_dev(dev), dma_address, size, direction);
 	else
 		BUG();
@@ -111,9 +123,9 @@
 int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
-	if (dev->bus == &vio_bus_type)
+	if (IS_VIO_DEV(dev))
 		return vio_map_sg(to_vio_dev(dev), sg, nents, direction);
 	BUG();
 	return 0;
@@ -123,9 +135,9 @@
 void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
+	if (IS_PCI_DEV(dev))
 		pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
-	else if (dev->bus == &vio_bus_type)
+	else if (IS_VIO_DEV(dev))
 		vio_unmap_sg(to_vio_dev(dev), sg, nhwentries, direction);
 	else
 		BUG();
diff -ruN ppc64-linux-2.5.for-ames.1/drivers/scsi/Kconfig ppc64-linux-2.5.for-ames.2/drivers/scsi/Kconfig
--- ppc64-linux-2.5.for-ames.1/drivers/scsi/Kconfig	2004-04-13 18:06:16.000000000 +1000
+++ ppc64-linux-2.5.for-ames.2/drivers/scsi/Kconfig	2004-05-04 16:45:08.000000000 +1000
@@ -762,7 +762,7 @@

 config SCSI_IBMVSCSI
 	tristate "IBM Virtual SCSI support"
-	depends on PPC_PSERIES || PPC_ISERIES
+	depends on (PPC_PSERIES || PPC_ISERIES) && PPC_VIO
 	help
 	  This is the IBM Virtual SCSI Client

@@ -771,7 +771,7 @@

 config SCSI_IBMVSCSIS
 	tristate "IBM Virtual SCSI Server support"
-	depends on PPC_PSERIES
+	depends on PPC_PSERIES && PPC_VIO
 	help
 	  This is the IBM Virtual SCSI Server
 	  To compile this driver as a module, choose M here: the


More information about the Linuxppc64-dev mailing list