From owner-svn-src-head@freebsd.org Wed Aug 8 16:08:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED93B1060678; Wed, 8 Aug 2018 16:08:39 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0587839FD; Wed, 8 Aug 2018 16:08:39 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CC714DCB; Wed, 8 Aug 2018 16:08:39 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w78G8dnW055918; Wed, 8 Aug 2018 16:08:39 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w78G8dMp055917; Wed, 8 Aug 2018 16:08:39 GMT (envelope-from br@FreeBSD.org) Message-Id: <201808081608.w78G8dMp055917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 8 Aug 2018 16:08:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337459 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 337459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2018 16:08:40 -0000 Author: br Date: Wed Aug 8 16:08:38 2018 New Revision: 337459 URL: https://svnweb.freebsd.org/changeset/base/337459 Log: Implement uma_small_alloc(), uma_small_free(). Reviewed by: markj Obtained from: arm64 Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16628 Modified: head/sys/riscv/include/vmparam.h head/sys/riscv/riscv/uma_machdep.c Modified: head/sys/riscv/include/vmparam.h ============================================================================== --- head/sys/riscv/include/vmparam.h Wed Aug 8 15:25:01 2018 (r337458) +++ head/sys/riscv/include/vmparam.h Wed Aug 8 16:08:38 2018 (r337459) @@ -223,10 +223,7 @@ #define VM_INITIAL_PAGEIN 16 #endif -/* - * RISCVTODO - * #define UMA_MD_SMALL_ALLOC - */ +#define UMA_MD_SMALL_ALLOC #ifndef LOCORE extern vm_paddr_t dmap_phys_base; Modified: head/sys/riscv/riscv/uma_machdep.c ============================================================================== --- head/sys/riscv/riscv/uma_machdep.c Wed Aug 8 15:25:01 2018 (r337458) +++ head/sys/riscv/riscv/uma_machdep.c Wed Aug 8 16:08:38 2018 (r337459) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -44,13 +45,39 @@ void * uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, int wait) { + vm_page_t m; + vm_paddr_t pa; + void *va; - panic("uma_small_alloc"); + *flags = UMA_SLAB_PRIV; + m = vm_page_alloc_domain(NULL, 0, domain, + malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + if (m == NULL) + return (NULL); + pa = m->phys_addr; +#if 0 + /* RISCVTODO: minidump */ + if ((wait & M_NODUMP) == 0) + dump_add_page(pa); +#endif + va = (void *)PHYS_TO_DMAP(pa); + if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) + bzero(va, PAGE_SIZE); + return (va); } void uma_small_free(void *mem, vm_size_t size, u_int8_t flags) { + vm_page_t m; + vm_paddr_t pa; - panic("uma_small_free"); + pa = DMAP_TO_PHYS((vm_offset_t)mem); +#if 0 + /* RISCVTODO: minidump */ + dump_drop_page(pa); +#endif + m = PHYS_TO_VM_PAGE(pa); + vm_page_unwire_noq(m); + vm_page_free(m); }