From nobody Fri Feb 10 21:22:44 2023 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PD6CB1wNZz3mvsb for ; Fri, 10 Feb 2023 21:22:46 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PD6CB19sNz3w7l; Fri, 10 Feb 2023 21:22:46 +0000 (UTC) (envelope-from se@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676064166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aP7eAens5A4gAMmwqXLLyUNC15IVUfAwYNgyYlqpJ4I=; b=dWmnWPa0lu6BuPliR8azjh0uppTsvAqL/V9tXrMRQ5ybjG1LfA/htzXM/XYQoTz+w706DX XuKiHN8DfHkbyP9PPReNQ/m8f2Cv7OhaLq24zGbIZBKB7eaFTqBFI372M2thu3XJHcQ0rC FgGwhJtc7K4RsnOOpSq/k7xh8N+FMlheBuKcf6GRjT562jNq4AP7POlSZRNYYp6ryV8S3P YL9ikDF6XxQCp9UkfS6hCDYRFG45pD42fl5vG8Q4MCD18jexX9Jd3cLc7UIAOQmdDiCZsG rZqGHk369GC/A1/K4pXSTYS3GzOtTCM/AgNDnue0kV6gu41XPfNnMWxShctT1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676064166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aP7eAens5A4gAMmwqXLLyUNC15IVUfAwYNgyYlqpJ4I=; b=ncm8FyoFCenzt8K8AVFxZ3HOSZFiO7AdbEp3wZE2lzUqGksRzCJlC1qJw/zfkdUFOoV/SN qq0qN4PDrh+4M0mu+jmf4PmRbESGI6HR73OkgnxW2aE+BpwsAovGGMac9i/6Jk24SfeLNc epAxY1UweEzrd28lpZF2BHvtgPCUmicJ5WQoL/AXHWrrry++nwR20WGvQ1G68rKhBjUnfT dJ8eY1SInXYT3y+L6bAAmKAQu8Tmj1G3QCGGpvZ7LcaRGDzV7XXyCUAbRNiajQiMGL7EtK Z8lkpDox9QVPj8GBxLtFuJZai9dda/nR+V+Cdk5s5GZWMwmg2SVnLPPasOgx+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676064166; a=rsa-sha256; cv=none; b=qd/tym4fEyf2l8WgitCLDCVqOJU8RVB2qOboNWpY1Jqlvsy08WnJerwBu4UKw+OGdeRfVn SXJJXMXacAiI5PbOWnN9LkCxD8PnAkFXdV7mQOaGFuI6Jnd7/7z6yiQyibcwcdZ/ccfvXv 2cY8cD/NSP9UAXhNIvW3+7iiZIl4rSf3Cyy+l+ELdf9inAMaoT56CMMBoAg7Ct4VHb2alo ShVh13GiScNmXlJHhJ75WFaJoNC5Hh8OqZAPcKjdDzCeI9n4QkKa4VdLkWmpPCB4iIaEg3 OzbEoj1O0w+Ill+9ZY8REK59MD92RU6s83JhH/WrQ8Bof5pYOTXc9POQTASTOw== Received: from [IPV6:2003:cd:5f2a:1000:cdcb:ad77:620a:c0ad] (p200300cd5f2a1000cdcbad77620ac0ad.dip0.t-ipconnect.de [IPv6:2003:cd:5f2a:1000:cdcb:ad77:620a:c0ad]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PD6C93YtYz10PK; Fri, 10 Feb 2023 21:22:45 +0000 (UTC) (envelope-from se@FreeBSD.org) Message-ID: Date: Fri, 10 Feb 2023 22:22:44 +0100 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 From: Stefan Esser Subject: Re: sym vs ncr driver for emulated LSI 53C895A Content-Language: de-DE To: Miroslav Lachman <000.fbsd@quip.cz> References: <4caf465e-4514-6dbb-1a65-8a27b9b1537e@quip.cz> Cc: freebsd-stable In-Reply-To: <4caf465e-4514-6dbb-1a65-8a27b9b1537e@quip.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ThisMailContainsUnwantedMimeParts: N Am 09.02.23 um 20:04 schrieb Miroslav Lachman: > I have FreeBSD 12.4 virtual machine installed inside KVM. This machine has 2 > disks. One is 30GB connected as VirtIO vtbd0. There is installed system. The > second is 20TB iSCSI connected to KVM and should be available inside VM as SCSI > disk da0 but it is not. This is an emulated SCSI controller in KVM instead of a physical controller on a PCI bus? The device emulation may be incomplete and may therefore violate assumptions made in the driver. The 53c8xx devices were complex and the driver contains a "firmware" blob that has to be executed using main CPU instructions by the emulated Symbios device. This is extremely inefficient compared to other emulstions (it takes hundreds of emulated controller instructions to execute trivial SCSI transfers). Why can't you use the iSCSI driver to connect to an iscsi device? Regarding the history of the ncr and sym drivers: I'm the co-author of the ncr driver, which originally supported only the NCR53c810 chip. Later additions of this device family added WIDE SCSI support and support for faster synchronous transfers, and their support was added to the ncr driver. Linux had after several years of development still no working driver for that chip. A Linux developer decided to port the FreeBSD ncr driver to Linux and improved it by adding support for NCR/Symbios chips with an extended command set. He preserved the FreeBSD specific code and this version was imported into FreeBSD as the sym driver (since the NCR controller business had been sold to Hyundai Electronics and named Symbios at that time). The Symbios driver got two sets of "Firmware", one with the limited instruction set of the original device and one using the "advanced" instructions of the later devices (53c825 and later, IIRC). I haven't had a system with SCSI drives (or even a PCI bus) for some time, and therefore can no longer test the driver. > I see following errors in a log > > sym0:1: message c sent on bad reselection. > sym0:1:control msgout: 80 6. > (probe1:sym0:0:1:0): INQUIRY. CDB: 12 00 00 00 24 00 > (probe1:sym0:0:1:0): CAM status: Command timeout > (probe1:sym0:0:1:0): Retrying command, 3 more tries remain > sym0:1: message c sent on bad reselection. > sym0:1:control msgout: 80 6. [...] > (probe1:sym0:0:1:0): INQUIRY. CDB: 12 00 00 00 24 00 > (probe1:sym0:0:1:0): CAM status: Command timeout > (probe1:sym0:0:1:0): Retrying command, 0 more tries remain > sym0:1: message c sent on bad reselection. > sym0:1:control msgout: 80 6. > (probe1:sym0:0:1:0): INQUIRY. CDB: 12 00 00 00 24 00 > (probe1:sym0:0:1:0): CAM status: Command timeout > (probe1:sym0:0:1:0): Error 5, Retries exhausted > > Relevant part of the dmesg: > > virtio_pci0: port 0xc200-0xc27f mem > 0xfc0b7000-0xfc0b7fff,0xfebf8000-0xfebfbfff irq 10 at device 5.0 on pci0 > vtblk0: on virtio_pci0 > vtblk0: 30720MB (62914560 512 byte sectors) > virtio_pci1: port 0xc2c0-0xc2ff mem > 0xfebfc000-0xfebfffff irq 10 at device 6.0 on pci0 > vtballoon0: on virtio_pci1 > sym0: <895a> port 0xc000-0xc0ff mem 0xfc0b8000-0xfc0b83ff,0xfc0b2000-0xfc0b3fff > irq 11 at device 7.0 on pci0 > sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking > sym1: <895a> port 0xc100-0xc1ff mem 0xfc0b9000-0xfc0b93ff,0xfc0b4000-0xfc0b5fff > irq 11 at device 8.0 on pci0 > sym1: No NVRAM, ID 7, Fast-40, LVD, parity checking > ahci0: port 0xc380-0xc39f mem > 0xfc0ba000-0xfc0bafff irq 10 at device 9.0 on pci0 [...] > The controller is listed by pciconf > > # pciconf -lv | grep -A4 sym > sym0@pci0:0:7:0:        class=0x010000 card=0x10000000 chip=0x00121000 rev=0x00 > hdr=0x00 >     vendor     = 'Broadcom / LSI' >     device     = '53c895a' >     class      = mass storage >     subclass   = SCSI > sym1@pci0:0:8:0:        class=0x010000 card=0x10000000 chip=0x00121000 rev=0x00 > hdr=0x00 >     vendor     = 'Broadcom / LSI' >     device     = '53c895a' >     class      = mass storage >     subclass   = SCSI > > I tried to search what should be the right driver for LSI 53c895a but I am a > bit confused. sym(4) is attached on boot, but it is also listed on hardware > notes and man page for ncr(4) driver > > https://www.freebsd.org/releases/12.4R/hardware/ The ncr driver has been removed from later FreeBSD releases, since sym covers all devices (since it is an extension of the ncr driver). > I tried to kldload ncr but can't load ncr: No such file or directory. > > Should ncr be built separately? (the system is running 12.4 with GENERIC kernel) No, ncr will not solve your problems and is not optimized for the 895a chip you use. > And how can I configure it to use ncr instead of sym? > Or are there any other way to make FreeBSD guest happy in KVM host? (I am not > controlling the KVM host, I don't know the exact configuration of it) The sym driver attached correctly, it should work. It has been more than 10 years since I last used the driver and had a machine with SCSI drives. In the meantime Marius Strobl made a few changes to the driver, but I do not know, whether he still has access to a system with that controller. The error messages: > (probe1:sym0:0:1:0): INQUIRY. CDB: 12 00 00 00 24 00 > (probe1:sym0:0:1:0): CAM status: Command timeout > (probe1:sym0:0:1:0): Retrying command, 3 more tries remain > sym0:1: message c sent on bad reselection. > sym0:1:control msgout: 80 6. The device should execute the INQUIRY command, but not reply was received (the device did not reselect the controlled). Several attempts are made, but the retries are exausted and the device is ignored. It seems that the selection/reselection and sending of SCSI messages is not perfectly emulated. You may want to contact the author of the 53c895a emulation, since you'll need debug output from that emulation in order to understand what's wrong. The driver has been used with all kinds of NCR and Symbios hostadapters when PCI and SCSI were relevant, and I do not know of any functional issues with real hardware. Regards, STefan