From nobody Wed Nov 24 16:10:26 2021 X-Original-To: dev-commits-src-main@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 7A94018B7CA5; Wed, 24 Nov 2021 16:10:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4HzmFJ1Ty9z3klH; Wed, 24 Nov 2021 16:10:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 8035D2F9AD; Wed, 24 Nov 2021 16:10:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <78d7b522-3de3-4011-c0cc-98e23779d577@FreeBSD.org> Date: Wed, 24 Nov 2021 08:10:26 -0800 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: git: 2eb2079554f4 - main - bhyve: keep physical and virtual COMMAND reg in sync Content-Language: en-US To: =?UTF-8?Q?Corvin_K=c3=b6hne?= , Emmanuel Vadot , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" References: <202111221530.1AMFUUJn079855@gitrepo.freebsd.org> <428e410d-33c1-7ff8-9689-41943db3d9c3@FreeBSD.org> <084d5b5845554221901ce4902fb878d1@beckhoff.com> <0d0a6a77-b2d1-d0c2-f0de-e5c97307e140@FreeBSD.org> <80ac3d256ce94f809a39f5badc864588@beckhoff.com> From: John Baldwin In-Reply-To: <80ac3d256ce94f809a39f5badc864588@beckhoff.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637770228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yaUS1eWjO86CsDeAMNDOq6Xtd7OP9NXX/tByfi40R1k=; b=yf/K0tvogEwFZTt+O8eAhn2rZI+bc+DDqhYn+W0VQ8Oyisp+zaRHzzHAsL7WiXfS5L/wzg ah+aghrhWWz6J2Eg7pUc+LRJ8hI68dRM3Tzc/XdXEA6RJ0FLQ6DAl17h1mLDDY7Dzyyuvk 1XVg3GupvpbWyvHzhdrkOhtwwpD58HQQDIthnZS98nIJalYauQsQrspqzizjcvtea1JNl2 8zUO5aBfn30eKQgc7jS0va+GjTFAR1MldTCJJsDfBQEUsUK+5C54iKcvo/K05jMj/qDZQs hWx5RGBKhTCydPqYpe85RECfgmd6dqnfvjgmJRiMCRKpnNeBRlEN7mJ2i2eLaQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637770228; a=rsa-sha256; cv=none; b=hSiNjs53E5Ygiy/3t4BzNOPpkGR3Q59y4yR7JLEn+hpqmF8fPmdkQ5KZPN8h9CxA2C4bsI kkDi5Ij5Rs/w8jHefpZ2E1Es18OME+yIBaCaWgAFifKaEahrM1B3+phzUZlXxoXBCYpEhv wvGshDBHmbFJw8F1mHqceKlmiZqHEhKG0fEZ0HwuzoBKhZkkurTJ9mj9PIuxS/F1HaBw+X N3O7kRHUZFDT+p46VeA3nGJPQFayjghtqTXn8zGZs4zkm1SUh0GCZqFfTDwaoyo71j3f5E eNXbWglGMUwxVGmKmGpVHHuNopfPe35uYkIjcuurGaI7tz0+xSfxGXU6hOCp/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 11/24/21 4:00 AM, Corvin Köhne wrote: > Hi John, > >> Would you be able to test if that change works in your environment? I was >> never able to confirm that it fixed the bug I was trying to address, but I >> do think it is more correct. The busmastering thing is to work around Linux >> clearing that flag on shutdown of a guest, and I wanted to preserve other >> bits in the command register that weren't related to BARs, etc. > > The change works in my environment. As you have mentioned, my Linux guest > clears the busmastering bit on shutdown. However, in my opinion we should > initialize the command register bits in the same way as a real system does. > > I took a short look into a public available PCI specification > (https://www.ics.uci.edu/~harris/ics216/pci/PCI_22.pdf). > For busmastering (and also for IO/Mem decoding) it states that it's default value > is 0. Therefore, I'd prefer to unconditionally clear those bits on startup. While it's true that real systems do that on reset, most firmware set those bits while populating BARs. Bhyve doesn't always run boot firmware to do those tasks and needs to provide working devices out of the box. This is similar to how bhyve pre-populates BARs with resources rather than relying on firmware to assign resources to BARs. -- John Baldwin