From nobody Fri Jan 14 14:20:39 2022 X-Original-To: dev-commits-src-branches@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 8DDA7195D892; Fri, 14 Jan 2022 14:20:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jb3P357qxz3M7T; Fri, 14 Jan 2022 14:20:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642170040; 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; bh=dTYzI1VWtdjpkk8adqO/VGhh34QYtTL55swC06ZCbw8=; b=GoQbe1zpSvXXpZFobA0nIINR5imOf9X0bbJuv/ah3pCfST12tolhfBCiK3OTXXb5cSEzvy FY/uNM/8iGJdqqduthYQGtmiNnD2BXirkKKwCnk63iACO1aKiPoYTu/7OLoxbWViLOHcqw kMdahImAYuVJKcCkj32x1h/E55hnFXtVdIlINDg8ryjp3fLKx+GzbqYz/hLQkkR4zVtXl5 QDLhZCCWPwDptuXlVU4xdvuHvxH63UNlnvsRuvGHycvIgWitRkTxZsLErwBx9HCGKUDx17 Frr/tv7mJ6wkpolainYaBrLOmXNms6lTO0up2FElVT2zb2QhNea6rw+SSjbH5Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 293671560F; Fri, 14 Jan 2022 14:20:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20EEKdfM087941; Fri, 14 Jan 2022 14:20:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20EEKdDg087940; Fri, 14 Jan 2022 14:20:39 GMT (envelope-from git) Date: Fri, 14 Jan 2022 14:20:39 GMT Message-Id: <202201141420.20EEKdDg087940@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: e5fb2bbad268 - stable/13 - bhyve: do not explicitly map fbuf framebuffer List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e5fb2bbad268ee5f2dab820cd9fe966e40e4b51e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642170040; 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; bh=dTYzI1VWtdjpkk8adqO/VGhh34QYtTL55swC06ZCbw8=; b=tqPpbX3O7yZWAMQQ0RtY4KzCG8nBygRlbIbf7AH3WDXpvfEj4PPrWmu+MbBuGHdVvzItda fzyj7AOdP/4yXvmi9I3jd25LQQ1nMd5edwT9qFkPu+j0fTyIBhW+jezZWHKogg3375dkSE h4m5PkgJ+zmbHjAS8vS9zF2BQr6UcwalWqKYLEEYc63PjSdGXeYxxl6p6TxM7/1RfQO7ER zZby+PtRmgLqi5WELIQI7Dz1qqMTTrhhVNFX0OoXgeoWbeCycYm/c6amPfxElxBwke6R0z JOmu5DjLE7i6i5AgQ/bVTdFbvKRWkwfAA+j8AdDMnvcuw7J5Ma+X4yVn9meTmw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642170040; a=rsa-sha256; cv=none; b=f2A83sUq8h5GwHPugeN7H+9A2wl7wHaGhp3WOgYbec3L+x+ix6xYZA2ujGPe6Sl1SCQbyE uZAJ76rgzD/8kjd9dM5E42+8tCBMXdkL4o+FmDg0aWLR8gGydCD8sKvR0kBUMnhRW1FSXp oY37FQEP9TqI0n6ahJkFTFRD7gIFrqBKswge9Qj2S0jC0RY6hjP1K96dgmD2ToZg2rVLne VBoqTXJqLVA8CfWkLn2uCV3CrcoM+mvAauIMDNeflwOQfzZp+3K7jMb1gSkbBU3FeahS6K amR70esN2Xt20lw9B6oP1BF1yuBCtsZmbDDvrLtmjPuBmaZEVWZJZX2j/VkkgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=e5fb2bbad268ee5f2dab820cd9fe966e40e4b51e commit e5fb2bbad268ee5f2dab820cd9fe966e40e4b51e Author: Corvin Köhne AuthorDate: 2021-11-18 15:26:34 +0000 Commit: Emmanuel Vadot CommitDate: 2022-01-14 14:17:28 +0000 bhyve: do not explicitly map fbuf framebuffer Allocating a BAR will call baraddr which maps the framebuffer. No need to allocate it explicitly on init. Reviewed by: grehan Sponsored by: Beckhoff Autmation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D32596 (cherry picked from commit 5085153ae4d55692415716e0ed03204bdf96d34a) --- usr.sbin/bhyve/pci_fbuf.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c index 9c5dbd9c6a40..4bf64e3f2adc 100644 --- a/usr.sbin/bhyve/pci_fbuf.c +++ b/usr.sbin/bhyve/pci_fbuf.c @@ -227,11 +227,11 @@ pci_fbuf_baraddr(struct vmctx *ctx, struct pci_devinst *pi, int baridx, return; sc = pi->pi_arg; - if (!enabled && sc->fbaddr != 0) { + if (!enabled) { if (vm_munmap_memseg(ctx, sc->fbaddr, FB_SIZE) != 0) EPRINTLN("pci_fbuf: munmap_memseg failed"); sc->fbaddr = 0; - } else if (sc->fb_base != NULL && sc->fbaddr == 0) { + } else { prot = PROT_READ | PROT_WRITE; if (vm_mmap_memseg(ctx, address, VM_FRAMEBUFFER, 0, FB_SIZE, prot) != 0) EPRINTLN("pci_fbuf: mmap_memseg failed"); @@ -375,7 +375,7 @@ pci_fbuf_render(struct bhyvegc *gc, void *arg) static int pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) { - int error, prot; + int error; struct pci_fbuf_softc *sc; if (fbuf_sc != NULL) { @@ -393,6 +393,13 @@ pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_DISPLAY); pci_set_cfgdata8(pi, PCIR_SUBCLASS, PCIS_DISPLAY_VGA); + sc->fb_base = vm_create_devmem( + ctx, VM_FRAMEBUFFER, "framebuffer", FB_SIZE); + if (sc->fb_base == MAP_FAILED) { + error = -1; + goto done; + } + error = pci_emul_alloc_bar(pi, 0, PCIBAR_MEM32, DMEMSZ); assert(error == 0); @@ -402,7 +409,6 @@ pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) error = pci_emul_add_msicap(pi, PCI_FBUF_MSI_MSGS); assert(error == 0); - sc->fbaddr = pi->pi_bar[1].addr; sc->memregs.fbsize = FB_SIZE; sc->memregs.width = COLS_DEFAULT; sc->memregs.height = ROWS_DEFAULT; @@ -423,27 +429,9 @@ pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) goto done; } - sc->fb_base = vm_create_devmem(ctx, VM_FRAMEBUFFER, "framebuffer", FB_SIZE); - if (sc->fb_base == MAP_FAILED) { - error = -1; - goto done; - } DPRINTF(DEBUG_INFO, ("fbuf frame buffer base: %p [sz %lu]", sc->fb_base, FB_SIZE)); - /* - * Map the framebuffer into the guest address space. - * XXX This may fail if the BAR is different than a prior - * run. In this case flag the error. This will be fixed - * when a change_memseg api is available. - */ - prot = PROT_READ | PROT_WRITE; - if (vm_mmap_memseg(ctx, sc->fbaddr, VM_FRAMEBUFFER, 0, FB_SIZE, prot) != 0) { - EPRINTLN("pci_fbuf: mapseg failed - try deleting VM and restarting"); - error = -1; - goto done; - } - console_init(sc->memregs.width, sc->memregs.height, sc->fb_base); console_fb_register(pci_fbuf_render, sc);