From nobody Mon Dec 15 01:53:17 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1499791919057830.7050044489496; Tue, 11 Jul 2017 09:51:59 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dUyLc-00045F-6m; Tue, 11 Jul 2017 18:49:16 +0200 Received: from mail-qk0-f194.google.com ([209.85.220.194]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2) (envelope-from ) id 1dUyLL-00041W-N0 for seabios@seabios.org; Tue, 11 Jul 2017 18:49:12 +0200 Received: by mail-qk0-f194.google.com with SMTP id v143so1430987qkb.3 for ; Tue, 11 Jul 2017 09:50:41 -0700 (PDT) Received: from localhost ([64.9.249.1]) by smtp.gmail.com with ESMTPSA id q36sm387903qtq.46.2017.07.11.09.50.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jul 2017 09:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=9cylbgxDqN6lhCkG4bGwXyWII/FLR7ymxCe594Z8oKU=; b=YeiKbXLlMrxknQQUDbN52BYrAXyTP7l9ZVJNLuEPQP4qxA8PpigVpYU2klAa5ZSbsf BQrtB2Mq7sH0Clh60wEFUOZZgy4+CSWJZ35/cd1i5M9qbNNuytICmi5lk8PRPVvASZR/ O2zXVJcWl5i4QjNn1QW4jlsVvkJowAuXUVaGnc4w6Ty3y8nHclkWATkIFyvKGA8hFTlM 1r9/MZNbZSXXpty04NcqQjFYpC8mFZzK0WAoi4fudAggm1XHvMyi56s2ON/7Cxht85Dg 7DC7UrwWOdbgZq45bdBbD+C8zy2KDCxB/97SsNLjhXZtDshlKKiXpUMAKRDN9Lv63CF/ LoKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=9cylbgxDqN6lhCkG4bGwXyWII/FLR7ymxCe594Z8oKU=; b=W07VoisaR8c12DOPLTzkkLHEl/WGNecEawEMcIM5AKnwIqVgX04pfOoyPcmSFEsM/9 TcC7Zr4ZmSfDuiav7fFgVI7LGjWLh7R8kxU+Yakfu/dR7f6RAeluIsDUt2fAGvbqml3/ i4bjf15OHxp3bPIViV/l9KYWVF9FQJqCxhDR9UK4oz133j8SGJt2hZkQjOgiR5X3KlDY T28QAeoMtkYOAosrSnMGXShF+cUWaNT4DmBBEJ4LWoBZ6lSkb0psRKil/VU2VBq6z9Gm +0WFidS3AFz9+eBADbK+3LGtC3t/x1dHIo8bIA2DYRM7ie+7wvsRjJqnYnYK+s/38xqR lYGQ== X-Gm-Message-State: AIVw111aH2ycG3XrnAgbV4lp2iAnBOI4jOUa8zlHc/ZlGYJQqjPnVA/y 4mD0Qf7I6oheFiUp1jEjnw== X-Received: by 10.55.54.196 with SMTP id d187mr1073319qka.96.1499791838989; Tue, 11 Jul 2017 09:50:38 -0700 (PDT) From: Kevin O'Connor To: seabios@seabios.org Date: Tue, 11 Jul 2017 12:50:32 -0400 Message-Id: <20170711165032.2443-5-kevin@koconnor.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170711165032.2443-1-kevin@koconnor.net> References: <20170711165032.2443-1-kevin@koconnor.net> X-Spam-Score: -4.0 (----) Subject: [SeaBIOS] [PATCH 4/4] virtio: Allocate drive_s storage in low memory X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use the "low" memory segment instead of the f-segment for the drive_s storage. This can help avoid running out of memory in the f-segment. Signed-off-by: Kevin O'Connor --- src/hw/virtio-blk.c | 12 ++++++------ src/hw/virtio-ring.c | 1 - src/hw/virtio-scsi.c | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index ad16200..88d7e54 100644 --- a/src/hw/virtio-blk.c +++ b/src/hw/virtio-blk.c @@ -32,9 +32,9 @@ struct virtiodrive_s { static int virtio_blk_op(struct disk_op_s *op, int write) { - struct virtiodrive_s *vdrive_gf =3D + struct virtiodrive_s *vdrive =3D container_of(op->drive_fl, struct virtiodrive_s, drive); - struct vring_virtqueue *vq =3D vdrive_gf->vq; + struct vring_virtqueue *vq =3D vdrive->vq; struct virtio_blk_outhdr hdr =3D { .type =3D write ? VIRTIO_BLK_T_OUT : VIRTIO_BLK_T_IN, .ioprio =3D 0, @@ -48,7 +48,7 @@ virtio_blk_op(struct disk_op_s *op, int write) }, { .addr =3D op->buf_fl, - .length =3D vdrive_gf->drive.blksize * op->count, + .length =3D vdrive->drive.blksize * op->count, }, { .addr =3D (void*)(&status), @@ -61,7 +61,7 @@ virtio_blk_op(struct disk_op_s *op, int write) vring_add_buf(vq, sg, 2, 1, 0, 0); else vring_add_buf(vq, sg, 1, 2, 0, 0); - vring_kick(&vdrive_gf->vp, vq, 1); + vring_kick(&vdrive->vp, vq, 1); =20 /* Wait for reply */ while (!vring_more_used(vq)) @@ -73,7 +73,7 @@ virtio_blk_op(struct disk_op_s *op, int write) /* Clear interrupt status register. Avoid leaving interrupts stuck if * VRING_AVAIL_F_NO_INTERRUPT was ignored and interrupts were raised. */ - vp_get_isr(&vdrive_gf->vp); + vp_get_isr(&vdrive->vp); =20 return status =3D=3D VIRTIO_BLK_S_OK ? DISK_RET_SUCCESS : DISK_RET_EBA= DTRACK; } @@ -99,7 +99,7 @@ init_virtio_blk(void *data) struct pci_device *pci =3D data; u8 status =3D VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER; dprintf(1, "found virtio-blk at %pP\n", pci); - struct virtiodrive_s *vdrive =3D malloc_fseg(sizeof(*vdrive)); + struct virtiodrive_s *vdrive =3D malloc_low(sizeof(*vdrive)); if (!vdrive) { warn_noalloc(); return; diff --git a/src/hw/virtio-ring.c b/src/hw/virtio-ring.c index 7205a0a..0ed3189 100644 --- a/src/hw/virtio-ring.c +++ b/src/hw/virtio-ring.c @@ -16,7 +16,6 @@ * */ =20 -#include "biosvar.h" // GET_GLOBAL #include "output.h" // panic #include "virtio-ring.h" #include "virtio-pci.h" diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c index 466b305..a87cad8 100644 --- a/src/hw/virtio-scsi.c +++ b/src/hw/virtio-scsi.c @@ -7,7 +7,6 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license. =20 -#include "biosvar.h" // GET_GLOBALFLAT #include "block.h" // struct drive_s #include "blockcmd.h" // scsi_drive_setup #include "config.h" // CONFIG_* @@ -114,7 +113,7 @@ virtio_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv) { struct virtio_lun_s *tmpl_vlun =3D container_of(tmpl_drv, struct virtio_lun_s, drive); - struct virtio_lun_s *vlun =3D malloc_fseg(sizeof(*vlun)); + struct virtio_lun_s *vlun =3D malloc_low(sizeof(*vlun)); if (!vlun) { warn_noalloc(); return -1; --=20 2.9.4 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios