From: Lukas Doktor Subject: [KVM-autotest][patch] Spread virtio_consoles across multiple PCIs Date: Fri, 26 Nov 2010 11:51:07 +0100 Message-ID: <1290768668-6125-1-git-send-email-ldoktor@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org, kvm-autotest@redhat.com, akong@redhat.com, lmr@redhat.com, ldoktor@redhat.com, jzupka@redhat.com Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org This patch spreads the virtconsoles and virtserialports across multiple virtio-serial-pci devices. There has been a discussion about how to test the communication between various topologies of virtio_consoles. This patch keeps the old way of configuration but still lets the user to test the communication in 1:N, N:1, N:M (no_pci : no_dev_per_pci) topologies. The logic is simple: Starting with virtconsoles it allocates them by two per one virtio-serial-pci device. It doesn't require any changes to tests_base.cfg but still when using more than 2 devices it transfers data between multiple PCIs. The layout can look like this: 3 consoles, 2 serialports: "CC|CS|S" => 3 virtio-serial-pci devices 3 consoles, 4 serialports: "CC|CS|SS|S" => 4 virtio-serial-pci devices ... Later in the test consoles are picked starting first available console: Layout: 3 consoles, 2 serialports: "CC|CS|S" virtio_console_smoke = "serialport;console" { 1st round: cc|cS|s => only the first serialport is used (1:1) 2nd round: Cc|cs|s => only the first console is used (1:1) } virtio_console_loopback = "console:console;serialport:serialport:console:console" { 1st round: CC|cs|s => first two consoles are used (1:N) 2nd round: CC|cS|S => first 2 consoles and first 2 serialports are used (N:M) } virtio_console_perf = "serialport" { 1st round: cc|cS|s => only the first serialport is used (1:1) } An example of "info qtree" with 3 consoles and 2 serialports: ... dev: virtio-serial-pci, id "virtio-serial-pci2" dev-prop: vectors = 32 dev-prop: class = 0x780 dev-prop: indirect_desc = off dev-prop: max_ports = 31 bus-prop: addr = 06.0 bus-prop: romfile = bus-prop: rombar = 1 class Class 0780, addr 00:06.0, pci id 1af4:1003 (sub 1af4:0003) bar 0: i/o at 0xc080 [0xc09f] bar 1: mem at 0xf2042000 [0xf2042fff] bus: virtio-serial-pci2.0 type virtio-serial-bus dev: virtserialport, id "p4" dev-prop: nr = 1 dev-prop: chardev = vs4 dev-prop: name = "serialport-4" dev-prop-int: id: 1 dev-prop-int: guest_connected: 0 dev-prop-int: host_connected: 1 dev: virtio-serial-pci, id "virtio-serial-pci1" dev-prop: vectors = 32 dev-prop: class = 0x780 dev-prop: indirect_desc = off dev-prop: max_ports = 31 bus-prop: addr = 05.0 bus-prop: romfile = bus-prop: rombar = 1 class Class 0780, addr 00:05.0, pci id 1af4:1003 (sub 1af4:0003) bar 0: i/o at 0xc060 [0xc07f] bar 1: mem at 0xf2041000 [0xf2041fff] bus: virtio-serial-pci1.0 type virtio-serial-bus dev: virtserialport, id "p3" dev-prop: nr = 1 dev-prop: chardev = vs3 dev-prop: name = "serialport-3" dev-prop-int: id: 1 dev-prop-int: guest_connected: 0 dev-prop-int: host_connected: 1 dev: virtconsole, id "c2" dev-prop: is_console = 1 dev-prop: nr = 0 dev-prop: chardev = vc2 dev-prop: name = "console-2" dev-prop-int: id: 0 dev-prop-int: guest_connected: 1 dev-prop-int: host_connected: 0 dev: virtio-serial-pci, id "virtio-serial-pci0" dev-prop: vectors = 32 dev-prop: class = 0x780 dev-prop: indirect_desc = off dev-prop: max_ports = 31 bus-prop: addr = 04.0 bus-prop: romfile = bus-prop: rombar = 1 class Class 0780, addr 00:04.0, pci id 1af4:1003 (sub 1af4:0003) bar 0: i/o at 0xc040 [0xc05f] bar 1: mem at 0xf2040000 [0xf2040fff] bus: virtio-serial-pci0.0 type virtio-serial-bus dev: virtconsole, id "c1" dev-prop: is_console = 1 dev-prop: nr = 1 dev-prop: chardev = vc1 dev-prop: name = "console-1" dev-prop-int: id: 1 dev-prop-int: guest_connected: 1 dev-prop-int: host_connected: 0 dev: virtconsole, id "c0" dev-prop: is_console = 1 dev-prop: nr = 0 dev-prop: chardev = vc0 dev-prop: name = "console-0" dev-prop-int: id: 0 dev-prop-int: guest_connected: 1 dev-prop-int: host_connected: 0 ...