From 4cdcc4bcf4ffbca300191150e86b1b50fe3278a7 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 17 Sep 2009 13:02:47 +0000 Subject: Handle virtio --- kernel/list_modules.pm | 5 +++- mdk-stage1/Makefile | 2 +- mdk-stage1/NEWS | 3 +++ mdk-stage1/probing.c | 59 ++++++++++++++++++++++++++++++++++++++++++ mdk-stage1/probing.h | 8 +++++- mdk-stage1/stage1.c | 2 ++ perl-install/Makefile.config | 2 +- perl-install/NEWS | 3 +++ perl-install/detect_devices.pm | 9 ++++++- perl-install/install/NEWS | 3 +++ 10 files changed, 91 insertions(+), 5 deletions(-) diff --git a/kernel/list_modules.pm b/kernel/list_modules.pm index 56f234750..378d80229 100644 --- a/kernel/list_modules.pm +++ b/kernel/list_modules.pm @@ -41,7 +41,7 @@ our %l = ( ], firewire => [ qw(eth1394 pcilynx) ], gigabit => [ - qw(atl1 atl1e bnx2 bnx2x cxgb cxgb3 dl2k e1000 e1000e et131x igb ipg ixgb ixgbe myri_sbus netxen_nic ns83820 qla3xxx r8169 s2io sfc sis190 sk98lin skge sky2 spidernet tehuti tg3 via-velocity yellowfin), + qw(atl1 atl1e bnx2 bnx2x cxgb cxgb3 dl2k e1000 e1000e et131x igb ipg ixgb ixgbe myri_sbus netxen_nic ns83820 qla3xxx r8169 s2io sfc sis190 sk98lin skge sky2 spidernet tehuti tg3 via-velocity virtio_net yellowfin), qw(bcm5820 bcm5700), #- encrypted ], @@ -139,6 +139,7 @@ our %l = ( firewire => [ qw(sbp2) ], cdrom => [ qw(ide-cd_mod sr_mod) ], card_reader => [ qw(sdhci tifm_sd tifm_7xx1) ], + virtual => [ qw(virtio_blk) ], }, ################################################################################ @@ -271,6 +272,8 @@ our %l = ( qw(evdev), qw(usblp printer), 'floppy', + qw(virtio_pci virtio_balloon), + #- these need checking qw(rrunner meye), ], diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile index 9058708bf..e3076ec0b 100644 --- a/mdk-stage1/Makefile +++ b/mdk-stage1/Makefile @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -VERSION=1.32 +VERSION=1.32.1 PRODUCT=drakx-installer-binaries # diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS index ebc492548..c88d6af7d 100644 --- a/mdk-stage1/NEWS +++ b/mdk-stage1/NEWS @@ -1,3 +1,6 @@ +1.32.1: +- handle virtio + 1.32: - automatically find compressed stage2 with automatic=method:disk diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c index 9dba6e6e8..334d0f7b7 100644 --- a/mdk-stage1/probing.c +++ b/mdk-stage1/probing.c @@ -315,6 +315,58 @@ void probe_pci_modules(enum driver_type type, char **pci_modules, unsigned int pciusb_free(&entries); } +/** Loads modules for known virtio devices + * + * virtio modules are not being loaded using the PCI probing mechanism + * because pcitable.gz does not have IDs for these devices. + * + * The possible correct solution for it is to fix the script which + * generates pcitable.gz to handle the virtio_device_id structure. + */ +void probe_virtio_modules(void) +{ + struct pciusb_entries entries; + int i; + char *name; + char *options; + int loaded_pci = 0; + + entries = pci_probe(); + for (i = 0; i < entries.nb; i++) { + struct pciusb_entry *e = &entries.entries[i]; + if (e->vendor == VIRTIO_PCI_VENDOR) { + if (!loaded_pci) { + log_message("loading virtio-pci"); + my_insmod("virtio_pci", ANY_DRIVER_TYPE, NULL, 0); + loaded_pci = 1; + } + + name = NULL; + options = NULL; + + switch (e->subdevice) { + case VIRTIO_ID_NET: + name = "virtio_net"; + options = "csum=0"; + break; + case VIRTIO_ID_BLOCK: + name = "virtio_blk"; + break; + case VIRTIO_ID_BALLOON: + name = "virtio_balloon"; + break; + default: + log_message("warning: unknown virtio device %04x", e->device); + } + if (name) { + log_message("virtio: loading %s", name); + my_insmod(name, ANY_DRIVER_TYPE, options, 0); + } + } + } + pciusb_free(&entries); +} + #ifdef ENABLE_USB void probe_that_type(enum driver_type type, enum media_bus bus) #else @@ -323,6 +375,7 @@ void probe_that_type(enum driver_type type, enum media_bus bus __attribute__ ((u { static int already_probed_usb_controllers = 0; static int already_loaded_usb_scsi = 0; + static int already_probed_virtio_devices = 0; /* ---- PCI probe ---------------------------------------------- */ if (bus != BUS_USB) { @@ -352,6 +405,12 @@ void probe_that_type(enum driver_type type, enum media_bus bus __attribute__ ((u probe_pci_modules(type, usb_controller_modules, usb_controller_modules_len); break; #endif + case VIRTIO_DEVICES: + if (already_probed_virtio_devices) + break; + probe_virtio_modules(); + already_probed_virtio_devices = 1; + break; default: break; } diff --git a/mdk-stage1/probing.h b/mdk-stage1/probing.h index bb185ef95..fe427f541 100644 --- a/mdk-stage1/probing.h +++ b/mdk-stage1/probing.h @@ -24,10 +24,16 @@ enum media_type { CDROM, DISK, FLOPPY, TAPE, UNKNOWN_MEDIA }; -enum driver_type { MEDIA_ADAPTERS, NETWORK_DEVICES, USB_CONTROLLERS, ANY_DRIVER_TYPE }; +enum driver_type { MEDIA_ADAPTERS, NETWORK_DEVICES, USB_CONTROLLERS, + VIRTIO_DEVICES, ANY_DRIVER_TYPE }; enum media_bus { BUS_IDE, BUS_SCSI, BUS_USB, BUS_PCMCIA, BUS_ANY }; +#define VIRTIO_PCI_VENDOR 0x1af4 +#define VIRTIO_ID_NET 0x0001 +#define VIRTIO_ID_BLOCK 0x0002 +#define VIRTIO_ID_BALLOON 0x0005 + void find_media(enum media_bus bus); void get_medias(enum media_type media, char *** names, char *** models, enum media_bus bus); char ** get_net_devices(void); diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index cdc207bfd..63f9d2ed2 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -413,6 +413,8 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) init_firmware_timeout(); init_frontend("Welcome to " DISTRIB_DESCR ", " __DATE__ " " __TIME__); + probe_that_type(VIRTIO_DEVICES, BUS_ANY); + /* load usb interface as soon as possible, helps usb mouse detection in stage2 */ probe_that_type(USB_CONTROLLERS, BUS_USB); diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config index 2fa42bfff..0fb48a342 100644 --- a/perl-install/Makefile.config +++ b/perl-install/Makefile.config @@ -1,5 +1,5 @@ # -*- Makefile -*- -VERSION:=11.71.9 +VERSION:=11.71.10 SUDO = sudo TMPDIR = /tmp diff --git a/perl-install/NEWS b/perl-install/NEWS index a18a1a77f..a0edf7779 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,5 +1,8 @@ +Version 11.71.10 - 17 September 2009 + - drakhelp: o fix firefox launch bug #29775 +- handle virtio devices Version 11.71.9 - 27 April 2009 diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 3e057d28f..a4cc3d05d 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -32,7 +32,7 @@ sub get() { #- 2. The first SCSI device if SCSI exists. Or #- 3. The first RAID device if RAID exists. - getIDE(), getSCSI(), getDAC960(), getCompaqSmartArray(), getATARAID(); + getIDE(), getSCSI(), getVirtIO(), getDAC960(), getCompaqSmartArray(), getATARAID(); } sub hds() { grep { may_be_a_hd($_) } get() } sub tapes() { grep { $_->{media_type} eq 'tape' } get() } @@ -366,6 +366,13 @@ sub getATARAID() { values %l; } +sub getVirtIO() { + -d '/sys/bus/virtio/devices' or return; + map { + { device => basename($_), info => "VirtIO block device", media_type => 'hd', bus => 'virtio' } + } + glob("/sys/bus/virtio/devices/*/block/*"); +} # cpu_name : arch() =~ /^alpha/ ? "cpu " : # arch() =~ /^ppc/ ? "processor" : "vendor_id" diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index ef8511762..a6e70aaea 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,8 +1,11 @@ +Version 11.71.10 - 17 September 2009 + - do allow to upgrade Mandrakelinux (regression introduced in 10.14) - handle new driver: o network: et131x, smsc95xx - fix detecting SMP (was broken we relied on install kernel being non-smp) (#44825) - fix reading compssUsers.pl if rpmsrate is forced (for example with drakx-in-chroot) +- handle virtio devices Version 11.69 - 11 October 2008 -- cgit v1.2.1