From owner-svn-soc-all@freebsd.org Sun Aug 9 22:38:31 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12F8399ED5D for ; Sun, 9 Aug 2015 22:38:31 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 048FBFB9 for ; Sun, 9 Aug 2015 22:38:31 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79McUhN015511 for ; Sun, 9 Aug 2015 22:38:30 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79McUYX015508 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 22:38:30 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 22:38:30 GMT Message-Id: <201508092238.t79McUYX015508@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289487 - soc2013/def/crashdump-head/sys/kern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 22:38:31 -0000 Author: def Date: Sun Aug 9 22:38:29 2015 New Revision: 289487 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289487 Log: Add a generic function to dump raw data. Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c ============================================================================== --- soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Aug 9 21:32:05 2015 (r289486) +++ soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Aug 9 22:38:29 2015 (r289487) @@ -1001,6 +1001,22 @@ return (0); } +static int +dump_check_bounds(struct dumperinfo *di, off_t offset, size_t length) +{ + + if (length != 0 && (offset < di->mediaoffset || + offset - di->mediaoffset + length > di->mediasize)) { + printf("Attempt to write outside dump device boundaries.\n" + "offset(%jd), mediaoffset(%jd), length(%ju), mediasize(%jd).\n", + (intmax_t)offset, (intmax_t)di->mediaoffset, + (uintmax_t)length, (intmax_t)di->mediasize); + return (ENOSPC); + } + + return (0); +} + #ifdef EKCD /* Encrypt data and call dumper. */ static int @@ -1015,6 +1031,10 @@ kdc = di->kdc; kdk = di->kdk; + error = dump_check_bounds(di, offset, length); + if (error != 0) + return (error); + /* Data have to be aligned to block size. */ if ((length % KERNELDUMP_BLOCK_SIZE) != 0) return (EINVAL); @@ -1059,32 +1079,24 @@ } #endif +/* Call dumper with bounds checking. */ static int -dump_check_bounds(struct dumperinfo *di, off_t offset, size_t length) +dump_raw_write(struct dumperinfo *di, void *virtual, vm_offset_t physical, + off_t offset, size_t length) { + int error; - if (length != 0 && (offset < di->mediaoffset || - offset - di->mediaoffset + length > di->mediasize)) { - printf("Attempt to write outside dump device boundaries.\n" - "offset(%jd), mediaoffset(%jd), length(%ju), mediasize(%jd).\n", - (intmax_t)offset, (intmax_t)di->mediaoffset, - (uintmax_t)length, (intmax_t)di->mediasize); - return (ENOSPC); - } + error = dump_check_bounds(di, offset, length); + if (error != 0) + return (error); - return (0); + return (di->dumper(di->priv, virtual, physical, offset, length)); } -/* Call dumper with bounds checking. */ int dump_write(struct dumperinfo *di, void *virtual, vm_offset_t physical, off_t offset, size_t length) { - int error; - - error = dump_check_bounds(di, offset, length); - if (error != 0) - return (error); #ifdef EKCD if (di->kdc->kdc_enable == 1) { @@ -1093,56 +1105,24 @@ } #endif - return (di->dumper(di->priv, virtual, physical, offset, length)); + return (dump_raw_write(di, virtual, physical, offset, length)); } int dump_write_header(struct dumperinfo *di, struct kerneldumpheader *kdh, vm_offset_t physical, off_t offset) { - int error; - error = dump_check_bounds(di, offset, sizeof(*kdh)); - if (error != 0) - return (error); - - error = di->dumper(di->priv, kdh, physical, offset, sizeof(*kdh)); - if (error != 0) - return (error); - -#ifdef EKCD - if (di->kdc->kdc_enable == 1) { - di->kdc->kdc_lastoffset = offset; - di->kdc->kdc_lastlength = sizeof(*kdh); - } -#endif - - return (0); + return (dump_raw_write(di, kdh, physical, offset, sizeof(*kdh))); } int dump_write_key(struct dumperinfo *di, struct kerneldumpkey *kdk, vm_offset_t physical, off_t offset) { - int error; - error = dump_check_bounds(di, offset, kerneldumpkey_size(kdk)); - if (error != 0) - return (error); - - error = di->dumper(di->priv, kdk, physical, offset, - kerneldumpkey_size(kdk)); - if (error != 0) - return (error); - -#ifdef EKCD - if (di->kdc->kdc_enable == 1) { - di->kdc->kdc_lastoffset = offset; - di->kdc->kdc_lastlength = kerneldumpkey_size(kdk); - } -#endif - - return (0); + return (dump_raw_write(di, kdk, physical, offset, + kerneldumpkey_size(kdk))); } void From owner-svn-soc-all@freebsd.org Sun Aug 9 23:02:34 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66A0E99D426 for ; Sun, 9 Aug 2015 23:02:34 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57E20D41 for ; Sun, 9 Aug 2015 23:02:34 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79N2Ya2068179 for ; Sun, 9 Aug 2015 23:02:34 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79N2XZi068145 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:02:33 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:02:33 GMT Message-Id: <201508092302.t79N2XZi068145@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289491 - soc2013/def/crashdump-head/sys/kern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:02:34 -0000 Author: def Date: Sun Aug 9 23:02:33 2015 New Revision: 289491 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289491 Log: Use dumperinfo.kdk instead of kerneldumpcrypto.kdc_enable to verify if EKCD is enabled. Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c ============================================================================== --- soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Aug 9 22:33:51 2015 (r289490) +++ soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Aug 9 23:02:33 2015 (r289491) @@ -143,7 +143,6 @@ MALLOC_DEFINE(M_KDK, "kerneldumpkey", "Kernel dump key structure"); static struct kerneldumpcrypto { - int kdc_enable; uint8_t kdc_key[KERNELDUMP_KEY_SIZE]; uint8_t kdc_iv[KERNELDUMP_IV_SIZE]; keyInstance kdc_ki; @@ -881,23 +880,19 @@ kdc->kdc_lastoffset = 0; kdc->kdc_lastlength = 0; - di->kdc = kdc; - di->kdk = kdk; - return (0); } static int kerneldump_sysctl_enable(SYSCTL_HANDLER_ARGS) { - int error; + int enable, error; - error = sysctl_handle_opaque(oidp, &dumpcrypto.kdc_enable, - sizeof(dumpcrypto.kdc_enable), req); + error = sysctl_handle_opaque(oidp, &enable, sizeof(enable), req); if (error != 0) return (error); - if (dumpcrypto.kdc_enable == 1) + if (enable == 1) dumper.kdk = dumpkey; else dumper.kdk = NULL; @@ -1099,7 +1094,7 @@ { #ifdef EKCD - if (di->kdc->kdc_enable == 1) { + if (di->kdk != NULL) { return (dump_encrypted_write(di, virtual, physical, offset, length)); } From owner-svn-soc-all@freebsd.org Sun Aug 9 23:07:13 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14AF399D4A4 for ; Sun, 9 Aug 2015 23:07:13 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01D11D81 for ; Sun, 9 Aug 2015 23:07:13 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79N7C4I079292 for ; Sun, 9 Aug 2015 23:07:12 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79N7CQJ079290 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:07:12 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:07:12 GMT Message-Id: <201508092307.t79N7CQJ079290@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289492 - soc2013/def/crashdump-head/sys/ddb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:07:13 -0000 Author: def Date: Sun Aug 9 23:07:11 2015 New Revision: 289492 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289492 Log: Disable EKCD in textdumps. Modified: soc2013/def/crashdump-head/sys/ddb/db_textdump.c Modified: soc2013/def/crashdump-head/sys/ddb/db_textdump.c ============================================================================== --- soc2013/def/crashdump-head/sys/ddb/db_textdump.c Sun Aug 9 23:02:33 2015 (r289491) +++ soc2013/def/crashdump-head/sys/ddb/db_textdump.c Sun Aug 9 23:07:11 2015 (r289492) @@ -427,6 +427,7 @@ void textdump_dumpsys(struct dumperinfo *di) { + struct kerneldumpkey *kdk; off_t dumplen, trailer_offset; if (di->blocksize != TEXTDUMP_BLOCKSIZE) { @@ -449,6 +450,12 @@ textdump_error = 0; /* + * Disable EKCD because we don't provide encrypted textdumps. + */ + kdk = di->kdk; + di->kdk = NULL; + + /* * Position the start of the dump so that we'll write the kernel dump * trailer immediately before the end of the partition, and then work * our way back. We will rewrite this header later to reflect the @@ -500,6 +507,11 @@ else printf("Textdump complete.\n"); textdump_pending = 0; + + /* + * Restore EKCD status. + */ + di->kdk = kdk; } /*- From owner-svn-soc-all@freebsd.org Sun Aug 9 23:11:06 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5666899D56B for ; Sun, 9 Aug 2015 23:11:06 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4336FF24 for ; Sun, 9 Aug 2015 23:11:06 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79NB6UL083858 for ; Sun, 9 Aug 2015 23:11:06 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79NB5Ur083853 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:11:05 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:11:05 GMT Message-Id: <201508092311.t79NB5Ur083853@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289493 - in soc2013/def/crashdump-head/sys: kern sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:11:06 -0000 Author: def Date: Sun Aug 9 23:11:04 2015 New Revision: 289493 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289493 Log: Add algorithm and keysize fields to kerneldumpkey. Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c soc2013/def/crashdump-head/sys/sys/kerneldump.h Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c ============================================================================== --- soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Aug 9 23:07:11 2015 (r289492) +++ soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Aug 9 23:11:04 2015 (r289493) @@ -80,6 +80,8 @@ #include #include +#include + #include #include @@ -938,6 +940,8 @@ return (ENOMEM); kdk->kdk_size = kdksize; + kdk->kdk_algorithm = CRYPTO_AES_CBC; + kdk->kdk_keysize = KERNELDUMP_KEY_SIZE; bcopy(dumpcrypto.kdc_iv, kdk->kdk_iv, sizeof(kdk->kdk_iv)); kdk->kdk_encryptedkeylen = encryptedkeylen; Modified: soc2013/def/crashdump-head/sys/sys/kerneldump.h ============================================================================== --- soc2013/def/crashdump-head/sys/sys/kerneldump.h Sun Aug 9 23:07:11 2015 (r289492) +++ soc2013/def/crashdump-head/sys/sys/kerneldump.h Sun Aug 9 23:11:04 2015 (r289493) @@ -93,6 +93,8 @@ struct kerneldumpkey { uint32_t kdk_size; + uint8_t kdk_algorithm; + uint8_t kdk_keysize; uint8_t kdk_iv[KERNELDUMP_IV_SIZE]; uint32_t kdk_encryptedkeylen; uint8_t kdk_encryptedkey[]; From owner-svn-soc-all@freebsd.org Sun Aug 9 23:17:47 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9836899D72E for ; Sun, 9 Aug 2015 23:17:47 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F4E916C for ; Sun, 9 Aug 2015 23:17:47 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79NHlU5090784 for ; Sun, 9 Aug 2015 23:17:47 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79NHkvi090782 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:17:46 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:17:46 GMT Message-Id: <201508092317.t79NHkvi090782@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289494 - soc2013/def/crashdump-head/sys/arm/arm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:17:47 -0000 Author: def Date: Sun Aug 9 23:17:46 2015 New Revision: 289494 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289494 Log: Add EKCD support on ARM. Modified: soc2013/def/crashdump-head/sys/arm/arm/minidump_machdep.c Modified: soc2013/def/crashdump-head/sys/arm/arm/minidump_machdep.c ============================================================================== --- soc2013/def/crashdump-head/sys/arm/arm/minidump_machdep.c Sun Aug 9 23:11:04 2015 (r289493) +++ soc2013/def/crashdump-head/sys/arm/arm/minidump_machdep.c Sun Aug 9 23:17:46 2015 (r289494) @@ -295,13 +295,15 @@ dumpsize += PAGE_SIZE; /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) { + if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2 + + kerneldumpkey_size(di->kdk)) { error = ENOSPC; goto fail; } dumplo = di->mediaoffset + di->mediasize - dumpsize; dumplo -= sizeof(kdh) * 2; + dumplo -= kerneldumpkey_size(di->kdk); progress = dumpsize; /* Initialize mdhdr */ @@ -314,17 +316,23 @@ mdhdr.kernbase = KERNBASE; mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, dumpsize, - di->blocksize); + kerneldumpkey_size(di->kdk), di->blocksize); printf("Physical memory: %u MB\n", ptoa((uintmax_t)physmem) / 1048576); printf("Dumping %llu MB:", (long long)dumpsize >> 20); /* Dump leader */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; dumplo += sizeof(kdh); + /* Dump key */ + error = dump_write_key(di, di->kdk, 0, dumplo); + if (error) + goto fail; + dumplo += kerneldumpkey_size(di->kdk); + /* Dump my header */ bzero(&fakept, sizeof(fakept)); bcopy(&mdhdr, &fakept, sizeof(mdhdr)); @@ -455,7 +463,7 @@ } /* Dump trailer */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; dumplo += sizeof(kdh); From owner-svn-soc-all@freebsd.org Sun Aug 9 23:20:45 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7292099D861 for ; Sun, 9 Aug 2015 23:20:45 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48DAD206 for ; Sun, 9 Aug 2015 23:20:45 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79NKjSf094698 for ; Sun, 9 Aug 2015 23:20:45 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79NKiAA094682 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:20:44 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:20:44 GMT Message-Id: <201508092320.t79NKiAA094682@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289495 - soc2013/def/crashdump-head/sys/i386/i386 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:20:45 -0000 Author: def Date: Sun Aug 9 23:20:44 2015 New Revision: 289495 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289495 Log: Add EKCD support on i386. Modified: soc2013/def/crashdump-head/sys/i386/i386/minidump_machdep.c Modified: soc2013/def/crashdump-head/sys/i386/i386/minidump_machdep.c ============================================================================== --- soc2013/def/crashdump-head/sys/i386/i386/minidump_machdep.c Sun Aug 9 23:17:46 2015 (r289494) +++ soc2013/def/crashdump-head/sys/i386/i386/minidump_machdep.c Sun Aug 9 23:20:44 2015 (r289495) @@ -249,12 +249,14 @@ dumpsize += PAGE_SIZE; /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) { + if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2 + + kerneldumpkey_size(di->kdk)) { error = ENOSPC; goto fail; } dumplo = di->mediaoffset + di->mediasize - dumpsize; dumplo -= sizeof(kdh) * 2; + dumplo -= kerneldumpkey_size(di->kdk); progress = dumpsize; /* Initialize mdhdr */ @@ -269,17 +271,24 @@ mdhdr.paemode = 1; #endif - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_I386_VERSION, dumpsize, di->blocksize); + mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_I386_VERSION, dumpsize, + kerneldumpkey_size(di->kdk), di->blocksize); printf("Physical memory: %ju MB\n", ptoa((uintmax_t)physmem) / 1048576); printf("Dumping %llu MB:", (long long)dumpsize >> 20); /* Dump leader */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; dumplo += sizeof(kdh); + /* Dump key */ + error = dump_write_key(di, di->kdk, 0, dumplo); + if (error) + goto fail; + dumplo += kerneldumpkey_size(di->kdk); + /* Dump my header */ bzero(&fakept, sizeof(fakept)); bcopy(&mdhdr, &fakept, sizeof(mdhdr)); @@ -369,7 +378,7 @@ goto fail; /* Dump trailer */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; dumplo += sizeof(kdh); From owner-svn-soc-all@freebsd.org Sun Aug 9 23:23:07 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8219299D8D7 for ; Sun, 9 Aug 2015 23:23:07 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 732926BF for ; Sun, 9 Aug 2015 23:23:07 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79NN7wx098994 for ; Sun, 9 Aug 2015 23:23:07 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79NN6SS098992 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:23:06 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:23:06 GMT Message-Id: <201508092323.t79NN6SS098992@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289496 - soc2013/def/crashdump-head/sys/mips/mips MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:23:07 -0000 Author: def Date: Sun Aug 9 23:23:06 2015 New Revision: 289496 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289496 Log: Add EKCD support on MIPS. Modified: soc2013/def/crashdump-head/sys/mips/mips/minidump_machdep.c Modified: soc2013/def/crashdump-head/sys/mips/mips/minidump_machdep.c ============================================================================== --- soc2013/def/crashdump-head/sys/mips/mips/minidump_machdep.c Sun Aug 9 23:20:44 2015 (r289495) +++ soc2013/def/crashdump-head/sys/mips/mips/minidump_machdep.c Sun Aug 9 23:23:06 2015 (r289496) @@ -227,6 +227,7 @@ origdumplo = dumplo = di->mediaoffset + di->mediasize - dumpsize; dumplo -= sizeof(kdh) * 2; + dumplo -= kerneldumpkey_size(di->kdk); progress = dumpsize; /* Initialize mdhdr */ @@ -239,18 +240,24 @@ mdhdr.kernbase = VM_MIN_KERNEL_ADDRESS; mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_MIPS_VERSION, dumpsize, - di->blocksize); + kerneldumpkey_size(di->kdk), di->blocksize); printf("Physical memory: %ju MB\n", (uintmax_t)ptoa((uintmax_t)physmem) / 1048576); printf("Dumping %llu MB:", (long long)dumpsize >> 20); /* Dump leader */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; dumplo += sizeof(kdh); + /* Dump key */ + error = dump_write_key(di, di->kdk, 0, dumplo); + if (error) + goto fail; + dumplo += kerneldumpkey_size(di->kdk); + /* Dump my header */ bzero(tmpbuffer, sizeof(tmpbuffer)); bcopy(&mdhdr, tmpbuffer, sizeof(mdhdr)); @@ -317,7 +324,7 @@ } /* Dump trailer */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; dumplo += sizeof(kdh); From owner-svn-soc-all@freebsd.org Sun Aug 9 23:25:42 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A405599D97A for ; Sun, 9 Aug 2015 23:25:42 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 950F1768 for ; Sun, 9 Aug 2015 23:25:42 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79NPg2u000249 for ; Sun, 9 Aug 2015 23:25:42 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79NPgKt000246 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:25:42 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:25:42 GMT Message-Id: <201508092325.t79NPgKt000246@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289497 - soc2013/def/crashdump-head/sys/sparc64/sparc64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:25:42 -0000 Author: def Date: Sun Aug 9 23:25:41 2015 New Revision: 289497 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289497 Log: Add EKCD support on SPARC64. Modified: soc2013/def/crashdump-head/sys/sparc64/sparc64/dump_machdep.c Modified: soc2013/def/crashdump-head/sys/sparc64/sparc64/dump_machdep.c ============================================================================== --- soc2013/def/crashdump-head/sys/sparc64/sparc64/dump_machdep.c Sun Aug 9 23:23:06 2015 (r289496) +++ soc2013/def/crashdump-head/sys/sparc64/sparc64/dump_machdep.c Sun Aug 9 23:25:41 2015 (r289497) @@ -104,7 +104,7 @@ DEV_BSIZE); size += hdrsize; - totsize = size + 2 * sizeof(kdh); + totsize = size + 2 * sizeof(kdh) + kerneldumpkey_size(di->kdk); if (totsize > di->mediasize) { printf("Insufficient space on device (need %ld, have %ld), " "refusing to dump.\n", (long)totsize, @@ -117,16 +117,22 @@ dumplo = di->mediaoffset + di->mediasize - totsize; mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_SPARC64_VERSION, size, - di->blocksize); + kerneldumpkey_size(di->kdk), di->blocksize); printf("Dumping %lu MB (%d chunks)\n", (u_long)(size >> 20), nreg); /* Dump leader */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; dumplo += sizeof(kdh); + /* Dump key */ + error = dump_write_key(di, di->kdk, 0, dumplo); + if (error) + goto fail; + dumplo += kerneldumpkey_size(di->kdk); + /* Dump the private header. */ hdr.dh_hdr_size = hdrsize; hdr.dh_tsb_pa = tsb_kernel_phys; @@ -153,7 +159,7 @@ goto fail; /* Dump trailer */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; From owner-svn-soc-all@freebsd.org Sun Aug 9 23:31:46 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75DC799DB6D for ; Sun, 9 Aug 2015 23:31:46 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62C85B5E for ; Sun, 9 Aug 2015 23:31:46 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79NVkm9007843 for ; Sun, 9 Aug 2015 23:31:46 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79NVjDc007839 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:31:45 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:31:45 GMT Message-Id: <201508092331.t79NVjDc007839@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289498 - soc2013/def/crashdump-head/sys/kern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:31:46 -0000 Author: def Date: Sun Aug 9 23:31:45 2015 New Revision: 289498 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289498 Log: Add EKCD support for physical dumps. Modified: soc2013/def/crashdump-head/sys/kern/kern_dump.c Modified: soc2013/def/crashdump-head/sys/kern/kern_dump.c ============================================================================== --- soc2013/def/crashdump-head/sys/kern/kern_dump.c Sun Aug 9 23:25:41 2015 (r289497) +++ soc2013/def/crashdump-head/sys/kern/kern_dump.c Sun Aug 9 23:31:45 2015 (r289498) @@ -322,12 +322,14 @@ hdrgap = fileofs - DEV_ALIGN(hdrsz); /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) { + if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2 + + kerneldumpkey_size(di->kdk)) { error = ENOSPC; goto fail; } dumplo = di->mediaoffset + di->mediasize - dumpsize; dumplo -= sizeof(kdh) * 2; + dumplo -= kerneldumpkey_size(di->kdk); mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARCH_VERSION, dumpsize, kerneldumpkey_size(di->kdk), di->blocksize); @@ -336,11 +338,17 @@ ehdr.e_phnum - DUMPSYS_NUM_AUX_HDRS); /* Dump leader */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; dumplo += sizeof(kdh); + /* Dump key */ + error = dump_write_key(di, di->kdk, 0, dumplo); + if (error) + goto fail; + dumplo += kerneldumpkey_size(di->kdk); + /* Dump ELF header */ error = dumpsys_buf_write(di, (char*)&ehdr, sizeof(ehdr)); if (error) @@ -370,7 +378,7 @@ goto fail; /* Dump trailer */ - error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); + error = dump_write_header(di, &kdh, 0, dumplo); if (error) goto fail; From owner-svn-soc-all@freebsd.org Sun Aug 9 23:34:53 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72EDE99DC17 for ; Sun, 9 Aug 2015 23:34:53 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 632C5C4D for ; Sun, 9 Aug 2015 23:34:53 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79NYr9E010291 for ; Sun, 9 Aug 2015 23:34:53 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79NYqP0010286 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:34:52 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:34:52 GMT Message-Id: <201508092334.t79NYqP0010286@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289499 - soc2013/def/crashdump-head/sys/kern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:34:53 -0000 Author: def Date: Sun Aug 9 23:34:52 2015 New Revision: 289499 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289499 Log: Add EKCD to kernel features. Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c ============================================================================== --- soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Aug 9 23:31:45 2015 (r289498) +++ soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Aug 9 23:34:52 2015 (r289499) @@ -142,6 +142,8 @@ &show_busybufs, 0, ""); #ifdef EKCD +FEATURE(ekcd, "Encrypted kernel crash dumps support"); + MALLOC_DEFINE(M_KDK, "kerneldumpkey", "Kernel dump key structure"); static struct kerneldumpcrypto { From owner-svn-soc-all@freebsd.org Sun Aug 9 23:36:47 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8358599DC66 for ; Sun, 9 Aug 2015 23:36:47 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74666CB0 for ; Sun, 9 Aug 2015 23:36:47 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t79NalJH011025 for ; Sun, 9 Aug 2015 23:36:47 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t79NakWp011017 for svn-soc-all@FreeBSD.org; Sun, 9 Aug 2015 23:36:46 GMT (envelope-from def@FreeBSD.org) Date: Sun, 9 Aug 2015 23:36:46 GMT Message-Id: <201508092336.t79NakWp011017@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289500 - soc2013/def/crashdump-head/etc/rc.d MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 23:36:47 -0000 Author: def Date: Sun Aug 9 23:36:46 2015 New Revision: 289500 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289500 Log: Use kern.features.ekcd sysctl to verify if kernel has EKCD. Modified: soc2013/def/crashdump-head/etc/rc.d/cryptcore Modified: soc2013/def/crashdump-head/etc/rc.d/cryptcore ============================================================================== --- soc2013/def/crashdump-head/etc/rc.d/cryptcore Sun Aug 9 23:34:52 2015 (r289499) +++ soc2013/def/crashdump-head/etc/rc.d/cryptcore Sun Aug 9 23:36:46 2015 (r289500) @@ -16,7 +16,7 @@ cryptcore_check() { - sysctl -Nq security.ekcd.enable >/dev/null + sysctl -Nq kern.features.ekcd >/dev/null if [ $? -ne 0 ]; then err 1 "Kernel is missing encrypted kernel crash dumps." fi From owner-svn-soc-all@freebsd.org Mon Aug 10 18:32:42 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFC6899E4A1 for ; Mon, 10 Aug 2015 18:32:42 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5DCFE64 for ; Mon, 10 Aug 2015 18:32:42 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIWgVW065209 for ; Mon, 10 Aug 2015 18:32:42 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIWfNd065181 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:32:41 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:32:41 GMT Message-Id: <201508101832.t7AIWfNd065181@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289525 - in soc2015/mihai/bhyve-on-arm-head: sys/dev/bvm usr.sbin/bhyvearm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:32:43 -0000 Author: mihai Date: Mon Aug 10 18:32:41 2015 New Revision: 289525 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289525 Log: usr.sbin: bhyvearm: modify consport/bvm_console address Modified: soc2015/mihai/bhyve-on-arm-head/sys/dev/bvm/bvm_console.c soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyvearm/consport.c Modified: soc2015/mihai/bhyve-on-arm-head/sys/dev/bvm/bvm_console.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/dev/bvm/bvm_console.c Mon Aug 10 17:18:21 2015 (r289524) +++ soc2015/mihai/bhyve-on-arm-head/sys/dev/bvm/bvm_console.c Mon Aug 10 18:32:41 2015 (r289525) @@ -38,6 +38,11 @@ #include #include +#if defined(__arm__) +#include +#include +#endif + #include #include @@ -67,7 +72,7 @@ #if defined(__i386__) || defined(__amd64__) #define BVM_CONS_PORT 0x220 #elif defined(__arm__) -#define BVM_CONS_PORT 0x220 +#define BVM_CONS_PORT 0x1c090000 #endif static int bvm_cons_port = BVM_CONS_PORT; @@ -112,9 +117,9 @@ } #if defined(__arm__) -#ifdef EARLY_PRINTF -early_putc_t * early_putc = (early_putc_t *) bvm_wcons; -#endif +//#ifdef EARLY_PRINTF +//early_putc_t * early_putc = (early_putc_t *) bvm_wcons; +//#endif #endif static void @@ -184,7 +189,7 @@ static void bvm_cnprobe(struct consdev *cp) { - int disabled, port; + int disabled; disabled = 0; cp->cn_pri = CN_DEAD; @@ -192,11 +197,13 @@ resource_int_value("bvmconsole", 0, "disabled", &disabled); if (!disabled) { + +#if defined(__i386__) || defined(__amd64__) if (resource_int_value("bvmconsole", 0, "port", &port) == 0) bvm_cons_port = port; -#if defined(__i386__) || defined(__amd64__) if (inw(bvm_cons_port) == BVM_CONS_SIG) #elif defined(__arm__) + bvm_cons_port = (int) pmap_mapdev(bvm_cons_port, 0x1000); if ((*(short *)bvm_cons_port) == BVM_CONS_SIG) #endif cp->cn_pri = CN_REMOTE; Modified: soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyvearm/consport.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyvearm/consport.c Mon Aug 10 17:18:21 2015 (r289524) +++ soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyvearm/consport.c Mon Aug 10 18:32:41 2015 (r289525) @@ -9,7 +9,7 @@ #include "mem.h" -#define BVM_CONSOLE_PORT 0x220 +#define BVM_CONSOLE_PORT 0x1c090000 #define BVM_CONS_SIG ('b' << 8 | 'v') static struct termios tio_orig, tio_new; From owner-svn-soc-all@freebsd.org Mon Aug 10 18:33:14 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46D1A99E4C9 for ; Mon, 10 Aug 2015 18:33:14 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 376DDF53 for ; Mon, 10 Aug 2015 18:33:14 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIXENZ065427 for ; Mon, 10 Aug 2015 18:33:14 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIXD46065413 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:33:13 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:33:13 GMT Message-Id: <201508101833.t7AIXD46065413@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289526 - soc2015/mihai/bhyve-on-arm-head/sys/conf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:33:14 -0000 Author: mihai Date: Mon Aug 10 18:33:13 2015 New Revision: 289526 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289526 Log: sys: conf: options.arm: add new VMM_ARM_VGIC option Modified: soc2015/mihai/bhyve-on-arm-head/sys/conf/options.arm Modified: soc2015/mihai/bhyve-on-arm-head/sys/conf/options.arm ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/conf/options.arm Mon Aug 10 18:32:41 2015 (r289525) +++ soc2015/mihai/bhyve-on-arm-head/sys/conf/options.arm Mon Aug 10 18:33:13 2015 (r289526) @@ -69,3 +69,4 @@ GFB_NO_MODE_CHANGE opt_gfb.h AT91C_MAIN_CLOCK opt_at91.h VFP opt_global.h +VMM_ARM_VGIC opt_global.h From owner-svn-soc-all@freebsd.org Mon Aug 10 18:35:05 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F141B99E58C for ; Mon, 10 Aug 2015 18:35:04 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D707AFC2 for ; Mon, 10 Aug 2015 18:35:04 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIZ4Yr066208 for ; Mon, 10 Aug 2015 18:35:04 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIZ3WS066200 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:35:03 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:35:03 GMT Message-Id: <201508101835.t7AIZ3WS066200@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289527 - in soc2015/mihai/bhyve-on-arm-head/sys/arm: conf fvp_ve-cortex_a15x1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:35:05 -0000 Author: mihai Date: Mon Aug 10 18:35:03 2015 New Revision: 289527 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289527 Log: sys: arm: conf: modify GUEST conf Added: soc2015/mihai/bhyve-on-arm-head/sys/arm/fvp_ve-cortex_a15x1/files.fvp_ve-cortex_a15x1_guest Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/conf/FVP_VE_CORTEX_A15x1_GUEST Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/conf/FVP_VE_CORTEX_A15x1_GUEST ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/conf/FVP_VE_CORTEX_A15x1_GUEST Mon Aug 10 18:33:13 2015 (r289526) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/conf/FVP_VE_CORTEX_A15x1_GUEST Mon Aug 10 18:35:03 2015 (r289527) @@ -14,10 +14,10 @@ files "../fvp_ve-cortex_a15x1/files.fvp_ve-cortex_a15x1_guest" -options KERNVIRTADDR=0xc0200000 -makeoptions KERNVIRTADDR=0xc0200000 -options KERNPHYSADDR=0xc0200000 -makeoptions KERNPHYSADDR=0xc0200000 +options KERNVIRTADDR=0xc0000000 +makeoptions KERNVIRTADDR=0xc0000000 +options KERNPHYSADDR=0xc0000000 +makeoptions KERNPHYSADDR=0xc0000000 options PHYSADDR=0xc0000000 options HZ=100 @@ -26,13 +26,14 @@ #options SMP # Enable multiple cores nooptions FREEBSD_BOOT_LOADER +nooptions VFP # Debugging for use in -current makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options BREAK_TO_DEBUGGER options DEBUG options EARLY_PRINTF -#options VERBOSE_SYSINIT # Enable verbose sysinit messages +options VERBOSE_SYSINIT # Enable verbose sysinit messages options KDB # Enable kernel debugger support # For minimum debugger support (stable branch) use: options KDB_TRACE # Print a stack trace for a panic @@ -47,7 +48,7 @@ #options ROOTDEVNAME=\"ufs:/dev/da0\" options MD_ROOT options MD_ROOT_SIZE=12288 -makeoptions MFS_IMAGE=/root/soc2015/mihai/ramdisk/ramdisk.img +makeoptions MFS_IMAGE=/root/soc2015/mihai/ramdisk/ramdisk-guest.img options ROOTDEVNAME=\"ffs:/dev/md0\" # Pseudo devices @@ -67,10 +68,10 @@ # GPIO -device gpio +#device gpio # Flattened Device Tree options FDT # Configure using FDT/DTB data options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=fvp_ve-cortex_a15x1.dts +makeoptions FDT_DTS_FILE=fvp_ve-cortex_a15x1_guest.dts Added: soc2015/mihai/bhyve-on-arm-head/sys/arm/fvp_ve-cortex_a15x1/files.fvp_ve-cortex_a15x1_guest ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/fvp_ve-cortex_a15x1/files.fvp_ve-cortex_a15x1_guest Mon Aug 10 18:35:03 2015 (r289527) @@ -0,0 +1,13 @@ +kern/kern_clocksource.c standard + +arm/arm/bus_space_base.c standard +arm/arm/bus_space_generic.c standard +arm/arm/bus_space_asm_generic.S standard + +#arm/arm/generic_timer.c standard +arm/fvp_ve-cortex_a15x1/sp804.c standard +arm/fvp_ve-cortex_a15x1/fvp_ve-cortex_a15x1_common.c standard +arm/fvp_ve-cortex_a15x1/fvp_ve-cortex_a15x1_machdep.c standard + +arm/fvp_ve-cortex_a15x1/fvp_ve-cortex_a15x1_semihosting.S standard + From owner-svn-soc-all@freebsd.org Mon Aug 10 18:35:43 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 868C399E59F for ; Mon, 10 Aug 2015 18:35:43 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 772DBFE0 for ; Mon, 10 Aug 2015 18:35:43 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIZhCC066421 for ; Mon, 10 Aug 2015 18:35:43 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIZg0e066418 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:35:42 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:35:42 GMT Message-Id: <201508101835.t7AIZg0e066418@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289528 - soc2015/mihai/bhyve-on-arm-head/sys/arm/conf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:35:43 -0000 Author: mihai Date: Mon Aug 10 18:35:42 2015 New Revision: 289528 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289528 Log: sys: arm: conf: FVP_VE_CORTEX_A15x1: modify root size and add new options ARM_VGIC Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/conf/FVP_VE_CORTEX_A15x1 Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/conf/FVP_VE_CORTEX_A15x1 ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/conf/FVP_VE_CORTEX_A15x1 Mon Aug 10 18:35:03 2015 (r289527) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/conf/FVP_VE_CORTEX_A15x1 Mon Aug 10 18:35:42 2015 (r289528) @@ -20,6 +20,8 @@ makeoptions KERNPHYSADDR=0xc0200000 options PHYSADDR=0xc0000000 +options VMM_ARM_VGIC + options HZ=100 options SCHED_ULE # ULE scheduler #options PLATFORM @@ -46,7 +48,7 @@ #options ROOTDEVNAME=\"ufs:/dev/da0\" options MD_ROOT -options MD_ROOT_SIZE=12288 +options MD_ROOT_SIZE=30720 makeoptions MFS_IMAGE=/root/soc2015/mihai/ramdisk/ramdisk.img options ROOTDEVNAME=\"ffs:/dev/md0\" From owner-svn-soc-all@freebsd.org Mon Aug 10 18:37:29 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEAA999E5B2 for ; Mon, 10 Aug 2015 18:37:29 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A994FB5 for ; Mon, 10 Aug 2015 18:37:29 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIbTkT067288 for ; Mon, 10 Aug 2015 18:37:29 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIbTs4067272 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:37:29 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:37:29 GMT Message-Id: <201508101837.t7AIbTs4067272@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289529 - soc2015/mihai/bhyve-on-arm-head/sys/arm/include MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:37:29 -0000 Author: mihai Date: Mon Aug 10 18:37:28 2015 New Revision: 289529 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289529 Log: sys: arm: include: pcpu.h: fix PCPU_MD_FIELDS when disabling VFP Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/pcpu.h Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/pcpu.h ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/include/pcpu.h Mon Aug 10 18:35:42 2015 (r289528) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/include/pcpu.h Mon Aug 10 18:37:28 2015 (r289529) @@ -50,7 +50,8 @@ char __pad[137] #else #define PCPU_MD_FIELDS \ - char __pad[157] + struct pmap *pc_curpmap; \ + char __pad[153] #endif #ifdef _KERNEL From owner-svn-soc-all@freebsd.org Mon Aug 10 18:38:02 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00C2D99E5D0 for ; Mon, 10 Aug 2015 18:38:02 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D984CD6 for ; Mon, 10 Aug 2015 18:38:01 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIc1g7067601 for ; Mon, 10 Aug 2015 18:38:01 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIc06J067595 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:38:00 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:38:00 GMT Message-Id: <201508101838.t7AIc06J067595@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289530 - in soc2015/mihai/bhyve-on-arm-head/sys/arm: arm include MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:38:02 -0000 Author: mihai Date: Mon Aug 10 18:38:00 2015 New Revision: 289530 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289530 Log: sys: arm: arm: gic.c: move defines in header to be used by other infrastructures Added: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/gic.h Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/arm/gic.c Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/arm/gic.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/arm/gic.c Mon Aug 10 18:37:28 2015 (r289529) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/arm/gic.c Mon Aug 10 18:38:00 2015 (r289530) @@ -49,88 +49,25 @@ #include #include #include +#include #include #include #include #include -/* We are using GICv2 register naming */ - -/* Distributor Registers */ -#define GICD_CTLR 0x000 /* v1 ICDDCR */ -#define GICD_TYPER 0x004 /* v1 ICDICTR */ -#define GICD_IIDR 0x008 /* v1 ICDIIDR */ -#define GICD_IGROUPR(n) (0x0080 + ((n) * 4)) /* v1 ICDISER */ -#define GICD_ISENABLER(n) (0x0100 + ((n) * 4)) /* v1 ICDISER */ -#define GICD_ICENABLER(n) (0x0180 + ((n) * 4)) /* v1 ICDICER */ -#define GICD_ISPENDR(n) (0x0200 + ((n) * 4)) /* v1 ICDISPR */ -#define GICD_ICPENDR(n) (0x0280 + ((n) * 4)) /* v1 ICDICPR */ -#define GICD_ICACTIVER(n) (0x0380 + ((n) * 4)) /* v1 ICDABR */ -#define GICD_IPRIORITYR(n) (0x0400 + ((n) * 4)) /* v1 ICDIPR */ -#define GICD_ITARGETSR(n) (0x0800 + ((n) * 4)) /* v1 ICDIPTR */ -#define GICD_ICFGR(n) (0x0C00 + ((n) * 4)) /* v1 ICDICFR */ -#define GICD_SGIR(n) (0x0F00 + ((n) * 4)) /* v1 ICDSGIR */ - -/* CPU Registers */ -#define GICC_CTLR 0x0000 /* v1 ICCICR */ -#define GICC_PMR 0x0004 /* v1 ICCPMR */ -#define GICC_BPR 0x0008 /* v1 ICCBPR */ -#define GICC_IAR 0x000C /* v1 ICCIAR */ -#define GICC_EOIR 0x0010 /* v1 ICCEOIR */ -#define GICC_RPR 0x0014 /* v1 ICCRPR */ -#define GICC_HPPIR 0x0018 /* v1 ICCHPIR */ -#define GICC_ABPR 0x001C /* v1 ICCABPR */ -#define GICC_IIDR 0x00FC /* v1 ICCIIDR*/ - -#define GIC_FIRST_IPI 0 /* Irqs 0-15 are SGIs/IPIs. */ -#define GIC_LAST_IPI 15 -#define GIC_FIRST_PPI 16 /* Irqs 16-31 are private (per */ -#define GIC_LAST_PPI 31 /* core) peripheral interrupts. */ -#define GIC_FIRST_SPI 32 /* Irqs 32+ are shared peripherals. */ - -/* First bit is a polarity bit (0 - low, 1 - high) */ -#define GICD_ICFGR_POL_LOW (0 << 0) -#define GICD_ICFGR_POL_HIGH (1 << 0) -#define GICD_ICFGR_POL_MASK 0x1 -/* Second bit is a trigger bit (0 - level, 1 - edge) */ -#define GICD_ICFGR_TRIG_LVL (0 << 1) -#define GICD_ICFGR_TRIG_EDGE (1 << 1) -#define GICD_ICFGR_TRIG_MASK 0x2 - -#ifndef GIC_DEFAULT_ICFGR_INIT -#define GIC_DEFAULT_ICFGR_INIT 0x00000000 -#endif - -struct arm_gic_softc { - device_t gic_dev; - struct resource * gic_res[3]; - bus_space_tag_t gic_c_bst; - bus_space_tag_t gic_d_bst; - bus_space_handle_t gic_c_bsh; - bus_space_handle_t gic_d_bsh; - uint8_t ver; - struct mtx mutex; - uint32_t nirqs; -}; - static struct resource_spec arm_gic_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Distributor registers */ { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* CPU Interrupt Intf. registers */ +#ifdef VMM_ARM_VGIC + { SYS_RES_MEMORY, 2, RF_ACTIVE }, /* Virtual Interface Control */ + { SYS_RES_MEMORY, 3, RF_ACTIVE }, /* Virtual CPU interface */ +#endif { -1, 0 } }; static struct arm_gic_softc *arm_gic_sc = NULL; -#define gic_c_read_4(_sc, _reg) \ - bus_space_read_4((_sc)->gic_c_bst, (_sc)->gic_c_bsh, (_reg)) -#define gic_c_write_4(_sc, _reg, _val) \ - bus_space_write_4((_sc)->gic_c_bst, (_sc)->gic_c_bsh, (_reg), (_val)) -#define gic_d_read_4(_sc, _reg) \ - bus_space_read_4((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg)) -#define gic_d_write_4(_sc, _reg, _val) \ - bus_space_write_4((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg), (_val)) - static int gic_config_irq(int irq, enum intr_trigger trig, enum intr_polarity pol); static void gic_post_filter(void *); @@ -146,6 +83,12 @@ {NULL, false} }; +struct arm_gic_softc * +get_arm_gic_sc(void) +{ + return arm_gic_sc; +} + static int arm_gic_probe(device_t dev) { Added: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/gic.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/include/gic.h Mon Aug 10 18:38:00 2015 (r289530) @@ -0,0 +1,107 @@ +#ifndef _MACHINE_GIC_H_ +#define _MACHINE_GIC_H_ + +#include + +/* We are using GICv2 register naming */ + +/* Distributor Registers */ +#define GICD_CTLR 0x000 /* v1 ICDDCR */ +#define GICD_TYPER 0x004 /* v1 ICDICTR */ +#define GICD_IIDR 0x008 /* v1 ICDIIDR */ +#define GICD_IGROUPR(n) (0x0080 + ((n) * 4)) /* v1 ICDISER */ +#define GICD_ISENABLER(n) (0x0100 + ((n) * 4)) /* v1 ICDISER */ +#define GICD_ICENABLER(n) (0x0180 + ((n) * 4)) /* v1 ICDICER */ +#define GICD_ISPENDR(n) (0x0200 + ((n) * 4)) /* v1 ICDISPR */ +#define GICD_ICPENDR(n) (0x0280 + ((n) * 4)) /* v1 ICDICPR */ +#define GICD_ICACTIVER(n) (0x0380 + ((n) * 4)) /* v1 ICDABR */ +#define GICD_IPRIORITYR(n) (0x0400 + ((n) * 4)) /* v1 ICDIPR */ +#define GICD_ITARGETSR(n) (0x0800 + ((n) * 4)) /* v1 ICDIPTR */ +#define GICD_ICFGR(n) (0x0C00 + ((n) * 4)) /* v1 ICDICFR */ +#define GICD_SGIR(n) (0x0F00 + ((n) * 4)) /* v1 ICDSGIR */ + +/* CPU Registers */ +#define GICC_CTLR 0x0000 /* v1 ICCICR */ +#define GICC_PMR 0x0004 /* v1 ICCPMR */ +#define GICC_BPR 0x0008 /* v1 ICCBPR */ +#define GICC_IAR 0x000C /* v1 ICCIAR */ +#define GICC_EOIR 0x0010 /* v1 ICCEOIR */ +#define GICC_RPR 0x0014 /* v1 ICCRPR */ +#define GICC_HPPIR 0x0018 /* v1 ICCHPIR */ +#define GICC_ABPR 0x001C /* v1 ICCABPR */ +#define GICC_IIDR 0x00FC /* v1 ICCIIDR*/ + +#define GIC_FIRST_IPI 0 /* Irqs 0-15 are SGIs/IPIs. */ +#define GIC_LAST_IPI 15 +#define GIC_FIRST_PPI 16 /* Irqs 16-31 are private (per */ +#define GIC_LAST_PPI 31 /* core) peripheral interrupts. */ +#define GIC_FIRST_SPI 32 /* Irqs 32+ are shared peripherals. */ + +/* First bit is a polarity bit (0 - low, 1 - high) */ +#define GICD_ICFGR_POL_LOW (0 << 0) +#define GICD_ICFGR_POL_HIGH (1 << 0) +#define GICD_ICFGR_POL_MASK 0x1 +/* Second bit is a trigger bit (0 - level, 1 - edge) */ +#define GICD_ICFGR_TRIG_LVL (0 << 1) +#define GICD_ICFGR_TRIG_EDGE (1 << 1) +#define GICD_ICFGR_TRIG_MASK 0x2 + + +#ifdef VMM_ARM_VGIC +#define GICH_HCR 0x0 +#define GICH_VTR 0x4 +#define GICH_VMCR 0x8 +#define GICH_MISR 0x10 +#define GICH_EISR0 0x20 +#define GICH_EISR1 0x24 +#define GICH_ELSR0 0x30 +#define GICH_ELSR1 0x34 +#define GICH_APR 0xF0 +#define GICH_LR0 0x100 +#endif + +#ifndef GIC_DEFAULT_ICFGR_INIT +#define GIC_DEFAULT_ICFGR_INIT 0x00000000 +#endif + +#ifdef VMM_ARM_VGIC +#define GIC_RES_COUNT 5 +#else +#define GIC_RES_COUNT 3 +#endif + +struct arm_gic_softc { + device_t gic_dev; + struct resource * gic_res[GIC_RES_COUNT]; + bus_space_tag_t gic_c_bst; + bus_space_tag_t gic_d_bst; + bus_space_handle_t gic_c_bsh; + bus_space_handle_t gic_d_bsh; +#ifdef VMM_ARM_VGIC + bus_space_tag_t gic_h_bst; + bus_space_handle_t gic_h_bsh; +#endif + uint8_t ver; + struct mtx mutex; + uint32_t nirqs; +}; + +#define gic_c_read_4(_sc, _reg) \ + bus_space_read_4((_sc)->gic_c_bst, (_sc)->gic_c_bsh, (_reg)) +#define gic_c_write_4(_sc, _reg, _val) \ + bus_space_write_4((_sc)->gic_c_bst, (_sc)->gic_c_bsh, (_reg), (_val)) +#define gic_d_read_4(_sc, _reg) \ + bus_space_read_4((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg)) +#define gic_d_write_4(_sc, _reg, _val) \ + bus_space_write_4((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg), (_val)) + +#ifdef VMM_ARM_VGIC +#define gic_h_read_4(_sc, _reg) \ + bus_space_read_4((_sc)->gic_h_bst, (_sc)->gic_h_bsh, (_reg)) +#define gic_h_write_4(_sc, _reg, _val) \ + bus_space_write_4((_sc)->gic_h_bst, (_sc)->gic_h_bsh, (_reg), (_val)) +#endif + +struct arm_gic_softc *get_arm_gic_sc(void); + +#endif From owner-svn-soc-all@freebsd.org Mon Aug 10 18:40:21 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8A4899E763 for ; Mon, 10 Aug 2015 18:40:21 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD672341 for ; Mon, 10 Aug 2015 18:40:21 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIeLxh069937 for ; Mon, 10 Aug 2015 18:40:21 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIeKY8069623 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:40:20 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:40:20 GMT Message-Id: <201508101840.t7AIeKY8069623@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289531 - soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:40:21 -0000 Author: mihai Date: Mon Aug 10 18:40:20 2015 New Revision: 289531 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289531 Log: sys: arm: vmm: vgic.c: added vgic probing and skeleton for ditributor emulation Added: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.c soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.h Added: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.c Mon Aug 10 18:40:20 2015 (r289531) @@ -0,0 +1,146 @@ +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include "mmu.h" +#include "vgic.h" +#include "arm.h" + + +static struct arm_gic_softc *gic_sc; +static uint64_t virtual_int_ctrl_vaddr; +static uint64_t virtual_int_ctrl_paddr; +static uint32_t virtual_int_ctrl_size; + +static uint64_t virtual_cpu_int_paddr; +static uint32_t virtual_cpu_int_size; + +static uint32_t lr_num; + +static int +vgic_dist_mmio_read(void *vm, int vcpuid, uint64_t gpa, uint64_t *rval, int size, + void *arg) +{ + printf("%s on cpu: %d with gpa: %llx size: %x\n", __func__, vcpuid, gpa, size); + return (0); +} + +static int +vgic_dist_mmio_write(void *vm, int vcpuid, uint64_t gpa, uint64_t val, int size, + void *arg) +{ + printf("%s on cpu: %d with gpa: %llx size: %x with val: %llx\n", __func__, vcpuid, gpa, size, val); + return (0); +} + +int +vgic_emulate_distributor(void *arg, int vcpuid, struct vm_exit *vme, bool *retu) +{ + struct hyp *hyp; + int error; + + hyp = arg; + + if (vme->u.inst_emul.gpa < hyp->vgic_distributor.distributor_base || + vme->u.inst_emul.gpa > hyp->vgic_distributor.distributor_base + PAGE_SIZE || + !hyp->vgic_attached) { + + *retu = true; + return (0); + } + + *retu = false; + error = vmm_emulate_instruction(hyp->vm, vcpuid, vme->u.inst_emul.gpa, &vme->u.inst_emul.vie, + vgic_dist_mmio_read, vgic_dist_mmio_write, retu); + + return (error); +} + +int +vgic_attach(void *arg, uint64_t distributor_paddr, uint64_t cpu_int_paddr) +{ + struct hyp *hyp; + struct hypctx *hypctx; + int i; + + hyp = arg; + + /* + * Set the distributor address which will be + * emulated using the MMIO infrasctructure + * */ + hyp->vgic_distributor.distributor_base = distributor_paddr; + hyp->vgic_distributor.cpu_int_base = cpu_int_paddr; + hyp->vgic_attached = true; + /* + * Set the Virtual Interface Control address to + * save/restore registers at context switch. + * Also set the number of LRs + * */ + for (i = 0; i < VM_MAXCPU; i++) { + hypctx = &hyp->ctx[i]; + hypctx->vgic_cpu_int.virtual_int_ctrl = virtual_int_ctrl_vaddr; + hypctx->vgic_cpu_int.lr_num = lr_num; + } + + /* Map the CPU Interface over the Virtual CPU Interface */ + lpae_vmmmap_set(arg, + (lpae_vm_vaddr_t)cpu_int_paddr, + (lpae_vm_paddr_t)virtual_cpu_int_paddr, + virtual_cpu_int_size, + VM_PROT_READ | VM_PROT_WRITE); + + return (0); +} + +int +vgic_hyp_init(void) +{ + if (!(gic_sc = get_arm_gic_sc())) { + printf("vgic_hyp_init: GIC no present\n"); + return (ENXIO); + } + if (gic_sc->gic_res[2] == NULL || gic_sc->gic_res[3] == NULL) { + printf("vgic_hyp_init: Virtual CPU interface control" + " and registers not present in DTS\n"); + return (ENXIO); + } + + /* Virtual Interface Control */ + gic_sc->gic_h_bst = rman_get_bustag(gic_sc->gic_res[2]); + gic_sc->gic_h_bsh = rman_get_bushandle(gic_sc->gic_res[2]); + virtual_int_ctrl_vaddr = (uint64_t)rman_get_virtual(gic_sc->gic_res[2]); + virtual_int_ctrl_paddr = (uint64_t)rman_get_start(gic_sc->gic_res[2]); + virtual_int_ctrl_size = rman_get_size(gic_sc->gic_res[2]); + + /* Virtual CPU Interface */ + virtual_cpu_int_paddr = rman_get_start(gic_sc->gic_res[3]); + virtual_cpu_int_size = rman_get_size(gic_sc->gic_res[3]); + + lr_num = (gic_h_read_4(gic_sc, GICH_VTR) & 0x3f) + 1; + + lpae_vmmmap_set(NULL, + (lpae_vm_vaddr_t)virtual_int_ctrl_vaddr, + (lpae_vm_paddr_t)virtual_int_ctrl_paddr, + virtual_int_ctrl_size, + VM_PROT_READ | VM_PROT_WRITE); + + return (0); +} Added: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.h Mon Aug 10 18:40:20 2015 (r289531) @@ -0,0 +1,34 @@ +#ifndef _VMM_VGIC_H_ +#define _VMM_VGIC_H_ + +#define VGIC_LR_NUM 64 +struct vm; +struct vm_exit; + +struct vgic_distributor { + uint64_t distributor_base; + uint64_t cpu_int_base; + + int nr_irqs; +}; + +struct vgic_cpu_int { + uint64_t virtual_int_ctrl; + uint32_t lr_num; + uint32_t hcr; + uint32_t vmcr; + uint32_t misr; + uint64_t eisr; + uint64_t elsr; + uint32_t apr; + uint32_t lr[VGIC_LR_NUM]; +}; + +int vgic_hyp_init(void); + +int vgic_emulate_distributor(void *arg, int vcpuid, + struct vm_exit *vme, bool *retu); + +int vgic_attach(void *arg, uint64_t distributor_paddr, + uint64_t cpu_int_paddr); +#endif From owner-svn-soc-all@freebsd.org Mon Aug 10 18:41:00 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08AF199E781 for ; Mon, 10 Aug 2015 18:41:00 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDB6F3CD for ; Mon, 10 Aug 2015 18:40:59 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIexRo071427 for ; Mon, 10 Aug 2015 18:40:59 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIexgQ071408 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:40:59 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:40:59 GMT Message-Id: <201508101840.t7AIexgQ071408@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289532 - soc2015/mihai/bhyve-on-arm-head/sys/arm/arm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:41:00 -0000 Author: mihai Date: Mon Aug 10 18:40:58 2015 New Revision: 289532 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289532 Log: sys: arm: arm: genassym.c: add VGIC controlls Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/arm/genassym.c Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/arm/genassym.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/arm/genassym.c Mon Aug 10 18:40:20 2015 (r289531) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/arm/genassym.c Mon Aug 10 18:40:58 2015 (r289532) @@ -132,11 +132,10 @@ #ifdef VFP ASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate)); - ASSYM(PC_CPU, offsetof(struct pcpu, pc_cpu)); +#endif ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); -#endif ASSYM(PAGE_SIZE, PAGE_SIZE); ASSYM(PMAP_DOMAIN_KERNEL, PMAP_DOMAIN_KERNEL); From owner-svn-soc-all@freebsd.org Mon Aug 10 18:42:19 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AE3299E797 for ; Mon, 10 Aug 2015 18:42:19 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8096D0 for ; Mon, 10 Aug 2015 18:42:19 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIgJjt075527 for ; Mon, 10 Aug 2015 18:42:19 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIgIOe075498 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:42:18 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:42:18 GMT Message-Id: <201508101842.t7AIgIOe075498@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289533 - soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:42:19 -0000 Author: mihai Date: Mon Aug 10 18:42:18 2015 New Revision: 289533 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289533 Log: sys: arm: arm: vmm: arm.c: fix gpa for inst_emul, probe vgic and map timers to the guest Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/arm.c Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/arm.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/arm.c Mon Aug 10 18:40:58 2015 (r289532) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/arm.c Mon Aug 10 18:42:18 2015 (r289533) @@ -21,6 +21,7 @@ #include "mmu.h" #include "arm.h" #include "hyp.h" +#include "vgic.h" #define HANDLED 1 #define UNHANDLED 0 @@ -146,6 +147,11 @@ printf("%s hyp_l1pd: %p, phys_hyp_l1pd %p\n", __func__, (void*) hyp_l1pd, (void*)phys_hyp_l1pd); vmm_call_hyp(&hyp_vector[0], stack_top, LOW(phys_hyp_l1pd), HIGH(phys_hyp_l1pd)); + /* Initialize VGIC infrastructure */ + if (vgic_hyp_init()) { + return (ENXIO); + } + return 0; } @@ -190,6 +196,8 @@ } hyp->vm = vm; + hyp->vgic_attached = false; + hyp->l1pd_phys = (lpae_pd_entry_t) vtophys(&hyp->l1pd[0]); set_vttbr(hyp); @@ -197,7 +205,7 @@ hypctx = &hyp->ctx[i]; hypctx->vcpu = i; hypctx->hyp = hyp; - hypctx->hcr = HCR_GUEST_MASK; + hypctx->hcr = HCR_GUEST_MASK & ~HCR_TSW & ~HCR_TAC & ~HCR_IMO & ~HCR_FMO; hypctx->midr = cpu_ident(); hypctx->mpidr = (cp15_mpidr_get() & MPIDR_SMP_MASK) | MPIDR_AFF1_LEVEL(i) | @@ -211,6 +219,20 @@ sizeof(struct hyp), VM_PROT_READ | VM_PROT_WRITE); + /* Map Timer0 SP804 */ + lpae_vmmmap_set(hyp, + (lpae_vm_vaddr_t)0x1c110000, + (lpae_vm_paddr_t)0x1c110000, + PAGE_SIZE, + VM_PROT_READ | VM_PROT_WRITE); + + lpae_vmmmap_set(hyp, + (lpae_vm_vaddr_t)0x1c120000, + (lpae_vm_paddr_t)0x1c120000, + PAGE_SIZE, + VM_PROT_READ | VM_PROT_WRITE); + + return (hyp); } @@ -367,7 +389,8 @@ * Build the instruction info and return to user to emulate */ vmexit->exitcode = VM_EXITCODE_INST_EMUL; - vmexit->u.inst_emul.gpa = vmexit->u.hyp.hdfar; + vmexit->u.inst_emul.gpa = ((uint64_t)(vmexit->u.hyp.hpfar >> 4) << 12) | + (vmexit->u.hyp.hdfar & ((1 << 12) - 1)); vmexit->u.inst_emul.vie.access_size = HSR_ISS_ACCESS_SIZE(HSR_ISS_SAS(hsr_iss)); vmexit->u.inst_emul.vie.sign_extend = HSR_ISS_SSE(hsr_iss); vmexit->u.inst_emul.vie.dir = HSR_ISS_WnR(hsr_iss); @@ -378,12 +401,12 @@ // vmexit->u.inst_emul.vie.dir, vmexit->u.inst_emul.vie.reg); } else { - printf("%s:%d DABT from guest at address %x witho a stage-2 fault != translation\n", - __func__, __LINE__, vmexit->u.hyp.hdfar); + printf("%s:%d DABT from guest at address %x with hsr %x with a stage-2 fault != translation\n", + __func__, __LINE__, vmexit->u.hyp.hdfar, vmexit->u.hyp.hsr); } } else { - printf("%s:%d DABT from guest at address %x without a stage-2 fault translation\n", - __func__, __LINE__, vmexit->u.hyp.hdfar); + printf("%s:%d DABT from guest at address %x with hsr %x, hpfar: %x without a stage-2 fault translation\n", + __func__, __LINE__, vmexit->u.hyp.hdfar, vmexit->u.hyp.hsr, vmexit->u.hyp.hpfar); } break; case HSR_EC_DABT_HYP: From owner-svn-soc-all@freebsd.org Mon Aug 10 18:43:03 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAF2C99E7AA for ; Mon, 10 Aug 2015 18:43:03 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB6E16E6 for ; Mon, 10 Aug 2015 18:43:03 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIh3dd075838 for ; Mon, 10 Aug 2015 18:43:03 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIh3up075835 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:43:03 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:43:03 GMT Message-Id: <201508101843.t7AIh3up075835@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289534 - soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:43:03 -0000 Author: mihai Date: Mon Aug 10 18:43:02 2015 New Revision: 289534 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289534 Log: sys: arm: vmm: arm.h: added vgic fields for a vcpu and vgic_distributor for a VM Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/arm.h Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/arm.h ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/arm.h Mon Aug 10 18:42:18 2015 (r289533) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/arm.h Mon Aug 10 18:43:02 2015 (r289534) @@ -1,4 +1,5 @@ #include "mmu.h" +#include "vgic.h" #include struct hypctx { @@ -67,17 +68,19 @@ uint32_t hifar; /* VA at a Prefetch Abort exception */ uint32_t hpfar; /* IPA[39:12] at aborts on stage 2 address translations */ } exit_info; - + struct vgic_cpu_int vgic_cpu_int; }; struct hyp { - lpae_pd_entry_t l1pd[2 * LPAE_L1_ENTRIES]; - lpae_pd_entry_t vttbr; - uint64_t vmid_generation; - struct vm *vm; - lpae_pd_entry_t l1pd_phys; - struct hypctx ctx[VM_MAXCPU]; - }; + lpae_pd_entry_t l1pd[2 * LPAE_L1_ENTRIES]; + lpae_pd_entry_t vttbr; + uint64_t vmid_generation; + struct vm *vm; + lpae_pd_entry_t l1pd_phys; + struct hypctx ctx[VM_MAXCPU]; + bool vgic_attached; + struct vgic_distributor vgic_distributor; +}; CTASSERT((offsetof(struct hyp, l1pd) & PAGE_MASK) == 0); uint64_t vmm_call_hyp(void *hyp_func_addr, ...); @@ -94,6 +97,3 @@ #define MPIDR_SMP_MASK (0x3 << 30) #define MPIDR_AFF1_LEVEL(x) ((x >> 2) << 8) #define MPIDR_AFF0_LEVEL(x) ((x & 0x3) << 0) - - - From owner-svn-soc-all@freebsd.org Mon Aug 10 18:44:10 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 928C399E7E8 for ; Mon, 10 Aug 2015 18:44:10 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78A91766 for ; Mon, 10 Aug 2015 18:44:10 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIiAas076388 for ; Mon, 10 Aug 2015 18:44:10 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIi8xT076379 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:44:08 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:44:08 GMT Message-Id: <201508101844.t7AIi8xT076379@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289535 - in soc2015/mihai/bhyve-on-arm-head/sys/arm: include vmm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:44:10 -0000 Author: mihai Date: Mon Aug 10 18:44:08 2015 New Revision: 289535 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289535 Log: sys: arm: vmm: vmm.c: added a new ioctl VM_ATTACH_VGIC Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm.h soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm_dev.h soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm.h ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm.h Mon Aug 10 18:43:02 2015 (r289534) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm.h Mon Aug 10 18:44:08 2015 (r289535) @@ -128,6 +128,7 @@ int vm_get_capability(struct vm *vm, int vcpu, int type, int *val); int vm_set_capability(struct vm *vm, int vcpu, int type, int val); int vm_activate_cpu(struct vm *vm, int vcpu); +int vm_attach_vgic(struct vm *vm, uint64_t distributor_paddr, uint64_t cpu_int_paddr); struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid); void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip); void vm_exit_rendezvous(struct vm *vm, int vcpuid, uint64_t rip); Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm_dev.h ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm_dev.h Mon Aug 10 18:43:02 2015 (r289534) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm_dev.h Mon Aug 10 18:44:08 2015 (r289535) @@ -97,6 +97,11 @@ int vcpuid; }; +struct vm_attach_vgic { + uint64_t distributor_paddr; + uint64_t cpu_int_paddr; +}; + #define VM_ACTIVE_CPUS 0 #define VM_SUSPENDED_CPUS 1 @@ -126,6 +131,9 @@ /* vm_cpuset */ IOCNUM_ACTIVATE_CPU = 90, IOCNUM_GET_CPUSET = 91, + + /* vm_attach_vgic */ + IOCNUM_ATTACH_VGIC = 110, }; #define VM_RUN \ @@ -156,4 +164,7 @@ _IOW('v', IOCNUM_ACTIVATE_CPU, struct vm_activate_cpu) #define VM_GET_CPUS \ _IOW('v', IOCNUM_GET_CPUSET, struct vm_cpuset) +#define VM_ATTACH_VGIC \ + _IOW('v', IOCNUM_ATTACH_VGIC, struct vm_attach_vgic) + #endif Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c Mon Aug 10 18:43:02 2015 (r289534) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c Mon Aug 10 18:44:08 2015 (r289535) @@ -37,6 +37,7 @@ #include "vmm_stat.h" #include "vmm_mem.h" #include "mmu.h" +#include "vgic.h" struct vcpu { int flags; @@ -235,6 +236,10 @@ strcpy(vm->name, name); vm->cookie = VMINIT(vm); + /* TEMP - PL804 timer mapping */ + VMMMAP_SET(vm->cookie, 0x1c110000, 0x1c110000, PAGE_SIZE, + VM_PROT_ALL); + for (i = 0; i < VM_MAXCPU; i++) { vcpu_init(vm, i); } @@ -301,14 +306,17 @@ if (error == 0) { switch (vme->exitcode) { case VM_EXITCODE_INST_EMUL: - /* TODO there is no in-kernel emulation yet */ + /* Check fi we need to do in-kernel emulation */ + + pc = vme->pc + vme->inst_length; retu = true; + error = vgic_emulate_distributor(vm->cookie, vcpuid, vme, &retu); break; default: retu = true; /* handled in userland */ break; } - } + } if (error == 0 && retu == false) goto restart; @@ -625,4 +633,8 @@ return (0); } - +int +vm_attach_vgic(struct vm *vm, uint64_t distributor_paddr, uint64_t cpu_int_paddr) +{ + return vgic_attach(vm->cookie, distributor_paddr, cpu_int_paddr); +} Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c Mon Aug 10 18:43:02 2015 (r289534) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c Mon Aug 10 18:44:08 2015 (r289535) @@ -22,7 +22,6 @@ #include #include - struct vmmdev_softc { struct vm *vm; /* vm instance cookie */ struct cdev *cdev; @@ -81,6 +80,7 @@ struct vm_memory_segment *seg; struct vm_register *vmreg; struct vm_activate_cpu *vac; + struct vm_attach_vgic *vav; sc = vmmdev_lookup2(cdev); if (sc == NULL) @@ -115,6 +115,7 @@ break; case VM_MAP_MEMORY: + case VM_ATTACH_VGIC: /* * ioctls that operate on the entire virtual machine must * prevent all vcpus from running. @@ -166,7 +167,10 @@ case VM_ACTIVATE_CPU: vac = (struct vm_activate_cpu *)data; error = vm_activate_cpu(sc->vm, vac->vcpuid); - + case VM_ATTACH_VGIC: + vav = (struct vm_attach_vgic *)data; + error = vm_attach_vgic(sc->vm, vav->distributor_paddr, + vav->cpu_int_paddr); default: error = ENOTTY; break; From owner-svn-soc-all@freebsd.org Mon Aug 10 18:45:26 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB13F99E80F for ; Mon, 10 Aug 2015 18:45:26 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB3DF785 for ; Mon, 10 Aug 2015 18:45:26 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIjQhV077280 for ; Mon, 10 Aug 2015 18:45:26 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIjQLt077262 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:45:26 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:45:26 GMT Message-Id: <201508101845.t7AIjQLt077262@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289536 - soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:45:26 -0000 Author: mihai Date: Mon Aug 10 18:45:25 2015 New Revision: 289536 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289536 Log: sys: arm: arm: genassym.c: add VGIC controlls Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp_genassym.c Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp_genassym.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp_genassym.c Mon Aug 10 18:44:08 2015 (r289535) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp_genassym.c Mon Aug 10 18:45:25 2015 (r289536) @@ -76,6 +76,23 @@ ASSYM(HYPCTX_EXIT_INFO_HIFAR, offsetof(struct hypctx, exit_info.hifar)); ASSYM(HYPCTX_EXIT_INFO_HPFAR, offsetof(struct hypctx, exit_info.hpfar)); +ASSYM(HYPCTX_VGIC_INT_CTRL, offsetof(struct hypctx, vgic_cpu_int.virtual_int_ctrl)); +ASSYM(HYPCTX_VGIC_LR_NUM, offsetof(struct hypctx, vgic_cpu_int.lr_num)); +ASSYM(HYPCTX_VGIC_HCR, offsetof(struct hypctx, vgic_cpu_int.hcr)); +ASSYM(HYPCTX_VGIC_VMCR, offsetof(struct hypctx, vgic_cpu_int.vmcr)); +ASSYM(HYPCTX_VGIC_MISR, offsetof(struct hypctx, vgic_cpu_int.misr)); +ASSYM(HYPCTX_VGIC_EISR, offsetof(struct hypctx, vgic_cpu_int.eisr)); +ASSYM(HYPCTX_VGIC_ELSR, offsetof(struct hypctx, vgic_cpu_int.elsr)); +ASSYM(HYPCTX_VGIC_APR, offsetof(struct hypctx, vgic_cpu_int.apr)); +ASSYM(HYPCTX_VGIC_LR, offsetof(struct hypctx, vgic_cpu_int.lr)); + + + + + + + + From owner-svn-soc-all@freebsd.org Mon Aug 10 18:46:08 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 427ED99E823 for ; Mon, 10 Aug 2015 18:46:08 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32E727A2 for ; Mon, 10 Aug 2015 18:46:08 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIk8Os077675 for ; Mon, 10 Aug 2015 18:46:08 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIk769077668 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:46:07 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:46:07 GMT Message-Id: <201508101846.t7AIk769077668@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289537 - in soc2015/mihai/bhyve-on-arm-head/sys: arm/vmm boot/fdt/dts/arm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:46:08 -0000 Author: mihai Date: Mon Aug 10 18:46:06 2015 New Revision: 289537 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289537 Log: sys: boot: fdt: dts: arm: added new fvp guest dts Added: soc2015/mihai/bhyve-on-arm-head/sys/boot/fdt/dts/arm/fvp_ve-cortex_a15x1_guest.dts Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp.h Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp.h ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp.h Mon Aug 10 18:45:25 2015 (r289536) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp.h Mon Aug 10 18:46:06 2015 (r289537) @@ -145,7 +145,7 @@ * HCR_TSC - Trap SMC instruction * HCR_TWE - Trap WFE instruction * HCR_TWI - Trap WFI instruction - * HCR_BSU_IS - + * HCR_BSU_IS - Barrier shareability upgrade * HCR_FB - Force broadcast TLB/branch predictor/ cache invalidate across ISB * HCR_AMO - Overrides the CPSR.A bit, and enables signaling by the VA bit * HCR_IMO - Overrides the CPSR.I bit, and enables signaling by the VI bit Added: soc2015/mihai/bhyve-on-arm-head/sys/boot/fdt/dts/arm/fvp_ve-cortex_a15x1_guest.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2015/mihai/bhyve-on-arm-head/sys/boot/fdt/dts/arm/fvp_ve-cortex_a15x1_guest.dts Mon Aug 10 18:46:06 2015 (r289537) @@ -0,0 +1,100 @@ +/* + * ARM Ltd. Fast Models + * + * Versatile Express (VE) system model + * ARMCortexA15x1CT + * + * RTSM_VE_Cortex_A15x1.lisa + */ + +/dts-v1/; + +/ { + model = "FVP_VE_Cortex_A15x1"; + compatible = "arm,fvp_ve,cortex_a15x1"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { }; + + aliases { + serial0 = &v2m_serial0; + serial1 = &v2m_serial1; + serial2 = &v2m_serial2; + serial3 = &v2m_serial3; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a15"; + reg = <0>; + }; + }; + + memory@c0000000 { + device_type = "memory"; + reg = <0xc0000000 0x8000000>; + }; + + gic: interrupt-controller@2c001000 { + compatible = "arm,cortex-a15-gic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0x2c001000 0x1000>, + <0x2c002000 0x2000>, + <0x2c004000 0x2000>, + <0x2c006000 0x2000>; + }; + generic_timer { + compatible = "arm,armv7-timer"; + clock-frequency = <24000000>; + interrupts = < 29 30 27 26 >; + interrupt-parent = <&gic>; + }; + + v2m_serial0: uart@1c090000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x1c090000 0x1000>; + interrupt-parent=<&gic>; + interrupts = <37>; + }; + + v2m_serial1: uart@1c0a0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x1c0a0000 0x1000>; + interrupt-parent=<&gic>; + interrupts = <38>; + }; + + v2m_serial2: uart@1c0b0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x1c0b0000 0x1000>; + interrupt-parent=<&gic>; + interrupts = <39>; + }; + + v2m_serial3: uart@1c0c0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x1c0c0000 0x1000>; + interrupt-parent=<&gic>; + interrupts = <40>; + }; + v2m_timer01: timer@1c110000 { + compatible = "arm,sp804", "arm,primecell"; + reg = <0x1c110000 0x1000>; + interrupt-parent=<&gic>; + interrupts = <34>; + }; + + v2m_timer23: timer@1c120000 { + compatible = "arm,sp804", "arm,primecell"; + reg = <0x1c120000 0x1000>; + interrupt-parent=<&gic>; + interrupts = <35>; + }; +}; + From owner-svn-soc-all@freebsd.org Mon Aug 10 18:46:27 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A54B799E834 for ; Mon, 10 Aug 2015 18:46:27 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95E677BD for ; Mon, 10 Aug 2015 18:46:27 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIkR9I077779 for ; Mon, 10 Aug 2015 18:46:27 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIkRB8077776 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:46:27 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:46:27 GMT Message-Id: <201508101846.t7AIkRB8077776@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289538 - soc2015/mihai/bhyve-on-arm-head/sys/modules/vmm-arm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:46:27 -0000 Author: mihai Date: Mon Aug 10 18:46:26 2015 New Revision: 289538 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289538 Log: sys: modules: vmm-arm: Makefile: compile new vgic.c file Modified: soc2015/mihai/bhyve-on-arm-head/sys/modules/vmm-arm/Makefile Modified: soc2015/mihai/bhyve-on-arm-head/sys/modules/vmm-arm/Makefile ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/modules/vmm-arm/Makefile Mon Aug 10 18:46:06 2015 (r289537) +++ soc2015/mihai/bhyve-on-arm-head/sys/modules/vmm-arm/Makefile Mon Aug 10 18:46:26 2015 (r289538) @@ -16,6 +16,7 @@ mmu.c \ vmm_stat.c \ arm.c \ + vgic.c \ hyp.S CLEANFILES= hyp_assym.h hyp_genassym.o From owner-svn-soc-all@freebsd.org Mon Aug 10 18:47:25 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53EC599E84A for ; Mon, 10 Aug 2015 18:47:25 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43B127F6 for ; Mon, 10 Aug 2015 18:47:25 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AIlPrT078143 for ; Mon, 10 Aug 2015 18:47:25 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AIlNZ3078114 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 18:47:23 GMT (envelope-from mihai@FreeBSD.org) Date: Mon, 10 Aug 2015 18:47:23 GMT Message-Id: <201508101847.t7AIlNZ3078114@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289539 - in soc2015/mihai/bhyve-on-arm-head: lib/libvmmapiarm usr.sbin/bhyvearm usr.sbin/bhyveloadarm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 18:47:25 -0000 Author: mihai Date: Mon Aug 10 18:47:22 2015 New Revision: 289539 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289539 Log: usr.sbin: bhyve*: attach a vgic to a VM Modified: soc2015/mihai/bhyve-on-arm-head/lib/libvmmapiarm/vmmapi.c soc2015/mihai/bhyve-on-arm-head/lib/libvmmapiarm/vmmapi.h soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyvearm/bhyverun.c soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyveloadarm/bhyveloadarm.c Modified: soc2015/mihai/bhyve-on-arm-head/lib/libvmmapiarm/vmmapi.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/lib/libvmmapiarm/vmmapi.c Mon Aug 10 18:46:26 2015 (r289538) +++ soc2015/mihai/bhyve-on-arm-head/lib/libvmmapiarm/vmmapi.c Mon Aug 10 18:47:22 2015 (r289539) @@ -320,12 +320,22 @@ return (NULL); } -/* - * From Intel Vol 3a: - * Table 9-1. IA-32 Processor States Following Power-up, Reset or INIT - */ int vcpu_reset(struct vmctx *vmctx, int vcpu) { return (ENXIO); } + +int +vm_attach_vgic(struct vmctx *ctx, uint64_t distributor_paddr, uint64_t cpu_int_paddr) +{ + struct vm_attach_vgic vav; + + bzero(&vav, sizeof(vav)); + vav.distributor_paddr = distributor_paddr; + vav.cpu_int_paddr = cpu_int_paddr; + + return (ioctl(ctx->fd, VM_ATTACH_VGIC, &vav)); +} + + Modified: soc2015/mihai/bhyve-on-arm-head/lib/libvmmapiarm/vmmapi.h ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/lib/libvmmapiarm/vmmapi.h Mon Aug 10 18:46:26 2015 (r289538) +++ soc2015/mihai/bhyve-on-arm-head/lib/libvmmapiarm/vmmapi.h Mon Aug 10 18:47:22 2015 (r289539) @@ -68,4 +68,7 @@ /* Reset vcpu register state */ int vcpu_reset(struct vmctx *ctx, int vcpu); + +int vm_attach_vgic(struct vmctx *ctx, uint64_t distributor_paddr, uint64_t cpu_int_paddr); + #endif /* _VMMAPI_H_ */ Modified: soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyvearm/bhyverun.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyvearm/bhyverun.c Mon Aug 10 18:46:26 2015 (r289538) +++ soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyvearm/bhyverun.c Mon Aug 10 18:47:22 2015 (r289539) @@ -299,12 +299,10 @@ int max_vcpus; struct vmctx *ctx; uint64_t pc; - size_t memsize; bvmcons = 0; progname = basename(argv[0]); guest_ncpus = 1; - memsize = 256 * MB; while ((c = getopt(argc, argv, "abehAHIPp:g:c:s:S:m:")) != -1) { switch (c) { Modified: soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyveloadarm/bhyveloadarm.c ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyveloadarm/bhyveloadarm.c Mon Aug 10 18:46:26 2015 (r289538) +++ soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyveloadarm/bhyveloadarm.c Mon Aug 10 18:47:22 2015 (r289539) @@ -79,7 +79,7 @@ fprintf(stderr, "usage: %s [-k ] -l , -b \n" - " %*s [-m mem-size] \n", + " %*s [-m mem-size] [-p periphbase] \n", progname, (int)strlen(progname), ""); exit(1); @@ -92,6 +92,7 @@ int opt, error; int kernel_image_fd; uint64_t kernel_load_address, memory_base_address; + uint64_t periphbase; char kernel_image_name[KERNEL_IMAGE_NAME_LEN]; struct stat st; void *addr; @@ -101,9 +102,10 @@ mem_size = 128 * MB; kernel_load_address = 0xc0000000; memory_base_address = 0xc0000000; - strncpy(kernel_image_name, "wfi.out", KERNEL_IMAGE_NAME_LEN); + periphbase = 0x2c000000; + strncpy(kernel_image_name, "kernel.bin", KERNEL_IMAGE_NAME_LEN); - while ((opt = getopt(argc, argv, "k:l:b:m:")) != -1) { + while ((opt = getopt(argc, argv, "k:l:b:m:p")) != -1) { switch (opt) { case 'k': strncpy(kernel_image_name, optarg, KERNEL_IMAGE_NAME_LEN); @@ -117,6 +119,8 @@ case 'm': mem_size = strtoul(optarg, NULL, 0) * MB; break; + case 'p': + periphbase = strtoul(optarg, NULL, 0); case '?': usage(); } @@ -171,6 +175,9 @@ exit(1); } + error = vm_attach_vgic(ctx, periphbase + 0x1000, periphbase + 0x2000); + if (error) { + } munmap(addr, st.st_size); guest_setreg(VM_REG_GUEST_PC, kernel_load_address); From owner-svn-soc-all@freebsd.org Mon Aug 10 22:44:04 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF8B999E7AF for ; Mon, 10 Aug 2015 22:44:04 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEFD03F0 for ; Mon, 10 Aug 2015 22:44:04 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AMi4Xa018828 for ; Mon, 10 Aug 2015 22:44:04 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AMi4U7018824 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 22:44:04 GMT (envelope-from def@FreeBSD.org) Date: Mon, 10 Aug 2015 22:44:04 GMT Message-Id: <201508102244.t7AMi4U7018824@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289561 - soc2013/def/crashdump-head/sys/kern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 22:44:05 -0000 Author: def Date: Mon Aug 10 22:44:03 2015 New Revision: 289561 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289561 Log: Return valid EKCD status. Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c ============================================================================== --- soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Mon Aug 10 21:36:51 2015 (r289560) +++ soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Mon Aug 10 22:44:03 2015 (r289561) @@ -892,9 +892,16 @@ { int enable, error; + if (dumper.kdk != NULL) + enable = 1; + else + enable = 0; + error = sysctl_handle_opaque(oidp, &enable, sizeof(enable), req); - if (error != 0) + if (error != 0) { + printf("_enable error %d\n", error); return (error); + } if (enable == 1) dumper.kdk = dumpkey; From owner-svn-soc-all@freebsd.org Mon Aug 10 22:44:53 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51F8499E7F8 for ; Mon, 10 Aug 2015 22:44:53 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43159622 for ; Mon, 10 Aug 2015 22:44:53 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AMirLZ019821 for ; Mon, 10 Aug 2015 22:44:53 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7AMiqEc019817 for svn-soc-all@FreeBSD.org; Mon, 10 Aug 2015 22:44:52 GMT (envelope-from def@FreeBSD.org) Date: Mon, 10 Aug 2015 22:44:52 GMT Message-Id: <201508102244.t7AMiqEc019817@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289562 - soc2013/def/crashdump-head/sys/kern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 22:44:53 -0000 Author: def Date: Mon Aug 10 22:44:52 2015 New Revision: 289562 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289562 Log: Remove debug. Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c ============================================================================== --- soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Mon Aug 10 22:44:03 2015 (r289561) +++ soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Mon Aug 10 22:44:52 2015 (r289562) @@ -898,10 +898,8 @@ enable = 0; error = sysctl_handle_opaque(oidp, &enable, sizeof(enable), req); - if (error != 0) { - printf("_enable error %d\n", error); + if (error != 0) return (error); - } if (enable == 1) dumper.kdk = dumpkey; From owner-svn-soc-all@freebsd.org Tue Aug 11 06:27:33 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C11C99DA50 for ; Tue, 11 Aug 2015 06:27:33 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE06914A2 for ; Tue, 11 Aug 2015 06:27:32 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7B6RW6N056798 for ; Tue, 11 Aug 2015 06:27:32 GMT (envelope-from clord@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7B6RWDl056795 for svn-soc-all@FreeBSD.org; Tue, 11 Aug 2015 06:27:32 GMT (envelope-from clord@FreeBSD.org) Date: Tue, 11 Aug 2015 06:27:32 GMT Message-Id: <201508110627.t7B6RWDl056795@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to clord@FreeBSD.org using -f From: clord@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289575 - soc2015/clord/head/sys/contrib/ficl/amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2015 06:27:33 -0000 Author: clord Date: Tue Aug 11 06:27:31 2015 New Revision: 289575 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289575 Log: Modify amd64 header file to mirror changes made to i386/sysdep.h file Modified: soc2015/clord/head/sys/contrib/ficl/amd64/sysdep.h Modified: soc2015/clord/head/sys/contrib/ficl/amd64/sysdep.h ============================================================================== --- soc2015/clord/head/sys/contrib/ficl/amd64/sysdep.h Tue Aug 11 05:58:33 2015 (r289574) +++ soc2015/clord/head/sys/contrib/ficl/amd64/sysdep.h Tue Aug 11 06:27:31 2015 (r289575) @@ -86,14 +86,6 @@ #define UNS32 unsigned int #endif -#if !defined UNS16 -#define UNS16 unsigned short -#endif - -#if !defined UNS8 -#define UNS8 unsigned char -#endif - #if !defined NULL #define NULL ((void *)0) #endif @@ -102,7 +94,6 @@ ** FICL_UNS and FICL_INT must have the same size as a void* on ** the target system. A CELL is a union of void*, FICL_UNS, and ** FICL_INT. -** (11/2000: same for FICL_FLOAT) */ #if !defined FICL_INT #define FICL_INT long @@ -112,10 +103,6 @@ #define FICL_UNS unsigned long #endif -#if !defined FICL_FLOAT -#define FICL_FLOAT float -#endif - /* ** Ficl presently supports values of 32 and 64 for BITS_PER_CELL */ @@ -321,8 +308,8 @@ ** a new virtual machine's stacks, unless overridden at ** create time. */ -#if !defined FICL_DEFAULT_STACK -#define FICL_DEFAULT_STACK 128 +#if !defined FICL_DEFAULT_STACK_SIZE +#define FICL_DEFAULT_STACK_SIZE 128 #endif /* @@ -332,12 +319,12 @@ ** FICL_DEFAULT_ENV specifies the number of cells to allot ** for the environment-query dictionary. */ -#if !defined FICL_DEFAULT_DICT -#define FICL_DEFAULT_DICT 12288 +#if !defined FICL_DEFAULT_DICTIONARY_SIZE +#define FICL_DEFAULT_DICTIONARY_SIZE 12288 #endif -#if !defined FICL_DEFAULT_ENV -#define FICL_DEFAULT_ENV 260 +#if !defined FICL_DEFAULT_ENVIRONMENT_SIZE +#define FICL_DEFAULT_ENVIRONMENT_SIZE 260 #endif /* @@ -345,8 +332,8 @@ ** the dictionary search order. See Forth DPANS sec 16.3.3 ** (file://dpans16.htm#16.3.3) */ -#if !defined FICL_DEFAULT_VOCS -#define FICL_DEFAULT_VOCS 16 +#if !defined FICL_MAX_WORDLISTS +#define FICL_MAX_WORDLISTS 16 #endif /* @@ -430,5 +417,11 @@ #define FICL_HAVE_FTRUNCATE 0 #endif +/* +** Remove old definitions to remove conflicts with ficlcompatibility.h +** in case FICL_WANT_COMPATIBILITY is set. +*/ +#undef FICL_UNS +#undef FICL_INT #endif /*__SYSDEP_H__*/ From owner-svn-soc-all@freebsd.org Tue Aug 11 06:34:25 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DE0999DC3C for ; Tue, 11 Aug 2015 06:34:25 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F049183F for ; Tue, 11 Aug 2015 06:34:25 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7B6YPHV070327 for ; Tue, 11 Aug 2015 06:34:25 GMT (envelope-from clord@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7B6YO1l070325 for svn-soc-all@FreeBSD.org; Tue, 11 Aug 2015 06:34:24 GMT (envelope-from clord@FreeBSD.org) Date: Tue, 11 Aug 2015 06:34:24 GMT Message-Id: <201508110634.t7B6YO1l070325@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to clord@FreeBSD.org using -f From: clord@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289576 - soc2015/clord/head/sys/contrib/ficl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2015 06:34:25 -0000 Author: clord Date: Tue Aug 11 06:34:24 2015 New Revision: 289576 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289576 Log: Properly intialize the ficlDictionary struct in ficlDictionaryCreateHashed function. In particular, dictionary->base needed special attention since we want to be able to resize our dictionary, and changing it to a pointer rather than an array of size 1 requires an extra memory allocation. Modified: soc2015/clord/head/sys/contrib/ficl/dictionary.c Modified: soc2015/clord/head/sys/contrib/ficl/dictionary.c ============================================================================== --- soc2015/clord/head/sys/contrib/ficl/dictionary.c Tue Aug 11 06:27:31 2015 (r289575) +++ soc2015/clord/head/sys/contrib/ficl/dictionary.c Tue Aug 11 06:34:24 2015 (r289576) @@ -461,11 +461,14 @@ ficlDictionary *dictionary; size_t nAlloc; - nAlloc = sizeof(ficlDictionary) + (size * sizeof (ficlCell)) - + sizeof(ficlHash) + (bucketCount - 1) * sizeof (ficlWord *); + nAlloc = sizeof(ficlHash) + (size * sizeof (ficlCell)) + + (bucketCount - 1) * sizeof (ficlWord *); - dictionary = ficlMalloc(nAlloc); + dictionary = ficlMalloc(sizeof(ficlDictionary)); FICL_SYSTEM_ASSERT(system, dictionary != NULL); + memset(dictionary, 0, sizeof(ficlDictionary)); + dictionary->base = ficlMalloc(nAlloc); + FICL_SYSTEM_ASSERT(system, dictionary->base != NULL); dictionary->size = size; dictionary->system = system; From owner-svn-soc-all@freebsd.org Tue Aug 11 16:37:12 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3505E99E3E6 for ; Tue, 11 Aug 2015 16:37:12 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 251637DF for ; Tue, 11 Aug 2015 16:37:12 +0000 (UTC) (envelope-from mihai@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7BGbCAY060288 for ; Tue, 11 Aug 2015 16:37:12 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7BGbAa4060280 for svn-soc-all@FreeBSD.org; Tue, 11 Aug 2015 16:37:10 GMT (envelope-from mihai@FreeBSD.org) Date: Tue, 11 Aug 2015 16:37:10 GMT Message-Id: <201508111637.t7BGbAa4060280@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289596 - in soc2015/mihai/bhyve-on-arm-head/sys/arm: include vmm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2015 16:37:12 -0000 Author: mihai Date: Tue Aug 11 16:37:10 2015 New Revision: 289596 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289596 Log: sys: arm: vmm: hyp.S: save/restore vgic state at each context switch Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/gic.h soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp.S soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp_helpers.h Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/gic.h ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/include/gic.h Tue Aug 11 15:53:11 2015 (r289595) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/include/gic.h Tue Aug 11 16:37:10 2015 (r289596) @@ -1,7 +1,6 @@ #ifndef _MACHINE_GIC_H_ #define _MACHINE_GIC_H_ -#include /* We are using GICv2 register naming */ @@ -70,6 +69,8 @@ #define GIC_RES_COUNT 3 #endif +#ifndef __ASSEMBLER__ +#include struct arm_gic_softc { device_t gic_dev; struct resource * gic_res[GIC_RES_COUNT]; @@ -103,5 +104,6 @@ #endif struct arm_gic_softc *get_arm_gic_sc(void); +#endif #endif Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp.S ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp.S Tue Aug 11 15:53:11 2015 (r289595) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp.S Tue Aug 11 16:37:10 2015 (r289596) @@ -30,6 +30,8 @@ mcr p15, 4, r0, c13, c0, 2 @ Store hyp_vmxctx into HTPIDR save_host_regs + restore_vgic_regs + /* Save HOST CP15 registers */ load_cp15_regs_batch1 @ Load in r2-r12 CP15 regs push {r2-r12} @@ -128,6 +130,8 @@ pop {r2-r12} store_cp15_regs_batch1 @ Load in r2-r12 CP15 regs + save_vgic_regs + restore_host_regs mov r0, r1 @ r0 must hold the return value Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp_helpers.h ============================================================================== --- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp_helpers.h Tue Aug 11 15:53:11 2015 (r289595) +++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/hyp_helpers.h Tue Aug 11 16:37:10 2015 (r289596) @@ -1,6 +1,7 @@ #ifndef _VMM_HYP_HELPERS_H_ #define _VMM_HYP_HELPERS_H_ +#include /* Banked registers */ #define SAVE_GUEST_BANKED_REG(reg) \ @@ -256,4 +257,64 @@ ldr r3, [r0, #HYPCTX_CP15_AMAIR0]; \ ldr r6, [r0, #HYPCTX_CP15_AMAIR1] + +#define save_vgic_regs \ + ldr r2, [r0, #HYPCTX_VGIC_INT_CTRL]; \ + cmp r2, #0; \ + beq 1f; \ + \ + ldr r3, [r2, #GICH_HCR]; \ + str r3, [r0, #HYPCTX_VGIC_HCR]; \ + \ + ldr r3, [r2, #GICH_VMCR]; \ + str r3, [r0, #HYPCTX_VGIC_VMCR]; \ + \ + ldr r3, [r2, #GICH_MISR]; \ + str r3, [r0, #HYPCTX_VGIC_MISR]; \ + \ + ldr r3, [r2, #GICH_EISR0]; \ + ldr r4, [r2, #GICH_EISR1]; \ + str r3, [r2, #HYPCTX_VGIC_EISR]; \ + str r4, [r2, #(HYPCTX_VGIC_EISR + 4)]; \ + \ + ldr r3, [r2, #GICH_ELSR0]; \ + ldr r4, [r2, #GICH_ELSR1]; \ + str r3, [r0, #HYPCTX_VGIC_ELSR]; \ + str r4, [r0, #(HYPCTX_VGIC_ELSR + 4)]; \ + \ + ldr r3, [r2, #GICH_APR]; \ + str r3, [r0, #HYPCTX_VGIC_APR]; \ + \ + ldr r3, [r0, #HYPCTX_VGIC_LR_NUM]; \ + add r4, r2, #GICH_LR0; \ + add r5, r0, #HYPCTX_VGIC_LR; \ +2: ldr r6, [r4], #4; \ + str r6, [r5], #4; \ + subs r3, r3, #1; \ + bne 2b; \ +1: + +#define restore_vgic_regs \ + ldr r2, [r0, #HYPCTX_VGIC_INT_CTRL]; \ + cmp r2, #0; \ + beq 3f; \ + \ + ldr r3, [r0, #HYPCTX_VGIC_HCR]; \ + str r3, [r2, #GICH_HCR]; \ + \ + ldr r3, [r0, #HYPCTX_VGIC_VMCR]; \ + str r3, [r2, #GICH_VMCR]; \ + \ + str r3, [r0, #HYPCTX_VGIC_APR]; \ + ldr r3, [r2, #GICH_APR]; \ + \ + ldr r3, [r0, #HYPCTX_VGIC_LR_NUM]; \ + add r4, r2, #GICH_LR0; \ + add r5, r0, #HYPCTX_VGIC_LR; \ +4: ldr r6, [r5], #4; \ + str r6, [r4], #4; \ + subs r3, r3, #1; \ + bne 4b; \ +3: + #endif From owner-svn-soc-all@freebsd.org Wed Aug 12 19:03:20 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0B6E9A029C for ; Wed, 12 Aug 2015 19:03:20 +0000 (UTC) (envelope-from pratiksinghal@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F383DD8 for ; Wed, 12 Aug 2015 19:03:20 +0000 (UTC) (envelope-from pratiksinghal@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7CJ3KCt011105 for ; Wed, 12 Aug 2015 19:03:20 GMT (envelope-from pratiksinghal@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7CJ3KUG011089 for svn-soc-all@FreeBSD.org; Wed, 12 Aug 2015 19:03:20 GMT (envelope-from pratiksinghal@FreeBSD.org) Date: Wed, 12 Aug 2015 19:03:20 GMT Message-Id: <201508121903.t7CJ3KUG011089@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to pratiksinghal@FreeBSD.org using -f From: pratiksinghal@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289647 - soc2015/pratiksinghal/cubie-head/sys/arm/allwinner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Aug 2015 19:03:20 -0000 Author: pratiksinghal Date: Wed Aug 12 19:03:19 2015 New Revision: 289647 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289647 Log: Added the format and init methods, use of kobj class and other methods remaining Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.c Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.c ============================================================================== --- soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.c Wed Aug 12 18:47:30 2015 (r289646) +++ soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.c Wed Aug 12 19:03:19 2015 (r289647) @@ -42,6 +42,17 @@ /* TODO :- Add DMA support after the pio mode works corectly. */ +struct a10_ac97_channel +{ + struct snd_dbuf* buf; + struct pcm_channel* channel; + struct a10_ac97_info* parent; + uint32_t flags; + uint32_t fmt; + int type; + int8_t in_use; +}; + struct a10_ac97_info { device_t ac_dev; @@ -54,19 +65,27 @@ bus_space_tag_t ac97_bst; struct mtx ac97_mtx; struct ac97_info *codec; + struct a10_ac97_channel cht; /* Playing */ + struct a10_ac97_channel chr; /* Recording */ uint32_t ienab; uint32_t use_dma; }; +static int ac97_probe(device_t); +static int ac97_attach(device_t); +static int ac97_detach(device_t); +static void *a10_ac97_chan_init(kobj_t, void *, struct snd_dbuf *, struct pcm_channel *, int); +static int a10_ac97_setfmt(kobj_t, void *, uint32_t); + #define AC97_READ(_sc, _reg) \ bus_space_read_4((_sc)->ac97_bst, (_sc)->ac97_bsh, _reg) #define AC97_WRITE(_sc, _reg, _value) \ bus_space_write_4((_sc)->ac97_bst, (_sc)->ac97_bsh, _reg, _value) #define AC97_LOCK(_sc) \ - mtx_lock((_sc)->ac97_mtx) + mtx_lock(&(_sc)->ac97_mtx) #define AC97_UNLOCK(_sc) \ - mtx_unlock((_sc)->ac97_mtx) + mtx_unlock(&(_sc)->ac97_mtx) static int @@ -156,12 +175,74 @@ return (EBUSY); } -static device_method_t a10_ac97_methods[] = { - DEVMETHOD(device_probe, ac97_probe), - DEVMETHOD(device_attach, ac97_attach), - DEVMETHOD(device_detach, ac97_detach), +static void * a10_ac97_chan_init(kobj_t kobj, void *devinfo, struct snd_dbuf *b, + struct pcm_channel *c, int type) +{ + struct a10_ac97_info* sc = (struct a10_ac97_info*) devinfo; + struct a10_ac97_channel* ch; + + if (type == PCMDIR_PLAY) + ch = &(sc->cht); + else + ch = &(sc->chr); + + AC97_LOCK(sc); + ch->in_use = 1; + ch->buf = b; + ch->channel = c; + ch->parent = sc; + ch->type = type; + AC97_UNLOCK(sc); + + return (ch); +} + +static int a10_ac97_setfmt(kobj_t obj, void *chn, uint32_t fmt) +{ + struct a10_ac97_channel *channel = (struct a10_ac97_channel *)chn; + struct a10_ac97_info *sc = channel->parent; + uint32_t value; + + AC97_LOCK(sc); + value = AC_TX_MODE_2; + if (fmt & AFMT_16BIT) { + if (channel->type == PCMDIR_PLAY) + value |= AC_TX_RES_16; + else + value |= AC_RX_RES_16; + channel->fmt = fmt; + AC97_WRITE(sc,AC_FAT,value); + AC97_UNLOCK(sc); + + return (0); + } + else { + device_printf(channel->parent->ac_dev, "Resolution not supported\n"); + AC97_UNLOCK(sc); + + return -1; + } +} + +static kobj_method_t a10_ac97_chan_methods[] = { + KOBJMETHOD(channel_init, a10_ac97_chan_init), + KOBJMETHOD(channel_setformat, a10_ac97_setfmt), + //KOBJMETHOD(channel_setspeed, a10_ac97_speed), + //KOBJMETHOD(channel_setblocksize, a10_ac97_setblksz), + //KOBJMETHOD(channel_setfragments, a10_ac97_setfragments), + //KOBJMETHOD(channel_trigger, a10_ac97_chan_trigger), + //KOBJMETHOD(channel_getptr, a10_ac97_getptr), + //KOBJMETHOD(channel_getcaps, a10_ac97_getcaps) + KOBJMETHOD_END +}; - DEVMETHOD_END +CHANNEL_DECLARE(a10_ac97_chan); + +static device_method_t a10_ac97_methods[] = { + DEVMETHOD(device_probe, ac97_probe), + DEVMETHOD(device_attach, ac97_attach), + DEVMETHOD(device_detach, ac97_detach), + DEVMETHOD_END }; static devclass_t a10_ac97_devclass; From owner-svn-soc-all@freebsd.org Thu Aug 13 09:37:31 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7D5E99F980 for ; Thu, 13 Aug 2015 09:37:31 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6C95CD6 for ; Thu, 13 Aug 2015 09:37:31 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7D9bVw7024755 for ; Thu, 13 Aug 2015 09:37:31 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7D9bTUW024736 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 09:37:29 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 09:37:29 GMT Message-Id: <201508130937.t7D9bTUW024736@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289680 - soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 09:37:32 -0000 Author: stefano Date: Thu Aug 13 09:37:29 2015 New Revision: 289680 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289680 Log: bhyve-ptnetmap: cleanup and documentation Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/bhyve.8 soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/net_backends.c soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/ptnetmap.h Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/bhyve.8 ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/bhyve.8 Thu Aug 13 05:42:56 2015 (r289679) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/bhyve.8 Thu Aug 13 09:37:29 2015 (r289680) @@ -167,6 +167,8 @@ .It Li lpc LPC PCI-ISA bridge with COM1 and COM2 16550 serial ports. The LPC bridge emulation can only be configured on bus 0. +.It Li ptnetmap-memdev +Device used to share netmap memory in the guest. (required with ptnetmap backend) .El .It Op Ar conf This optional parameter describes the backend for device emulations. @@ -178,6 +180,17 @@ Network devices: .Bl -tag -width 10n .It Ar tapN Ns Op , Ns Ar mac=xx:xx:xx:xx:xx:xx +.It Ar [pt]netmap:XXX Ns Op , Ns Ar mac=xx:xx:xx:xx:xx:xx +.It Ar [pt]valeXXX:YYY Ns Op , Ns Ar mac=xx:xx:xx:xx:xx:xx +Use netmap/vale port as a backend for device emualtions. +.Pp +If "pt" prefix is specified, the port is opened in passthrough mode (ptnetmap). +One +.Ar ptnetmap-memdev +emulation is required for each ptnetmap port. (If two or more ptnetmap ports +share the same netmap memory allocator, only one +.Ar ptnetmap-memdev +is required) .It Ar vmnetN Ns Op , Ns Ar mac=xx:xx:xx:xx:xx:xx .Pp If @@ -285,6 +298,18 @@ -A -H -P -m 24G bigvm .Ed .Pp +Run a 2GB single-CPU virtual machine with three network ports which use netmap +and ptnetmap backends: +.Bd -literal -offset indent +bhyve -s 0,hostbridge -s 1,lpc \\ + -s 2:1,virtio-net,vale0:1 \\ + -s 2:2,ptnetmap-memdev \\ + -s 2:3,virtio-net,ptvale1:2 \\ + -s 3,ptnetmap-memdev \\ + -s 4,virtio-net,ptnetmap:ix0 \\ + -l com1,stdio -A -H -P -m 2G netmapvm +.Ed +.Pp Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI CD-ROM, a single virtio network port, an AMD hostbridge, and the console port connected to an Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/net_backends.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/net_backends.c Thu Aug 13 05:42:56 2015 (r289679) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/net_backends.c Thu Aug 13 09:37:29 2015 (r289680) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Vincenzo Maffione + * Copyright (c) 2014-2015 Vincenzo Maffione, Stefano Garzarella * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -109,6 +109,9 @@ */ uint64_t (*set_features)(struct net_backend *be, uint64_t features); + /* + * Get ptnetmap_state if the backend support ptnetmap + */ struct ptnetmap_state * (*get_ptnetmap)(struct net_backend *be); struct pci_vtnet_softc *sc; @@ -351,11 +354,11 @@ DATA_SET(net_backend_set, tap_backend); + /* * The netmap backend */ - /* The virtio-net features supported by netmap. */ #define NETMAP_FEATURES (VIRTIO_NET_F_CSUM | VIRTIO_NET_F_HOST_TSO4 | \ VIRTIO_NET_F_HOST_TSO6 | VIRTIO_NET_F_HOST_UFO | \ @@ -443,10 +446,10 @@ return 0; } -/* used by netmap and ptnetmap */ +/* used by netmap and ptnetmap during the initialization */ static int -netmap_commom_init(struct net_backend *be, struct netmap_priv *priv, uint32_t nr_flags, - const char *devname, net_backend_cb_t cb, void *param) +netmap_commom_init(struct net_backend *be, struct netmap_priv *priv, + uint32_t nr_flags, const char *devname, net_backend_cb_t cb, void *param) { const char *ndname = "/dev/netmap"; struct nmreq req; @@ -465,16 +468,6 @@ ndname, devname, strerror(errno))); goto err_open; } -#if 0 - /* check parent (nm_desc with the same allocator already mapped) */ - parent_nmd = netmap_find_parent(nmd); - /* mmap or inherit from parent */ - if (nm_mmap(nmd, parent_nmd)) { - error_report("failed to mmap %s: %s", netmap_opts->ifname, strerror(errno)); - nm_close(nmd); - return -1; - } -#endif priv->tx = NETMAP_TXRING(priv->nmd->nifp, 0); priv->rx = NETMAP_RXRING(priv->nmd->nifp, 0); @@ -500,9 +493,7 @@ netmap_init(struct net_backend *be, const char *devname, net_backend_cb_t cb, void *param) { - const char *ndname = "/dev/netmap"; struct netmap_priv *priv = NULL; - char tname[40]; priv = calloc(1, sizeof(struct netmap_priv)); if (priv == NULL) { @@ -740,6 +731,8 @@ /* * The ptnetmap backend + * + * use netmap name with "pt" prefix to open netmap port in ptnetmap mode */ #include /* IFNAMSIZ */ #include @@ -779,11 +772,8 @@ ptnbe_init(struct net_backend *be, const char *devname, net_backend_cb_t cb, void *param) { - const char *ndname = "/dev/netmap"; struct ptnbe_priv *priv = NULL; struct netmap_priv *npriv; - struct nmreq req; - char tname[40]; priv = calloc(1, sizeof(struct ptnbe_priv)); if (priv == NULL) { @@ -793,7 +783,8 @@ npriv = &priv->up; - if (netmap_commom_init(be, npriv, NR_PTNETMAP_HOST, devname + PTNETMAP_NAME_HDR, cb, param)) { + if (netmap_commom_init(be, npriv, NR_PTNETMAP_HOST, + devname + PTNETMAP_NAME_HDR, cb, param)) { goto err; } @@ -834,7 +825,8 @@ { struct ptnbe_priv *priv = be->priv; - ptn_memdev_attach(priv->up.nmd->mem, priv->up.nmd->memsize, priv->up.nmd->req.nr_arg2); + ptn_memdev_attach(priv->up.nmd->mem, priv->up.nmd->memsize, + priv->up.nmd->req.nr_arg2); priv->ptns.ptn_be = be; priv->created = 0; @@ -860,6 +852,7 @@ priv->acked_features |= features; } +/* get required netmap_if info from the netmap port opened in ptnetmap mode */ int ptnetmap_get_mem(struct ptnetmap_state *ptns) { @@ -877,6 +870,7 @@ return 0; } +/* get the memory allocator ID info from the netmap port opened in ptnetmap mode */ int ptnetmap_get_hostmemid(struct ptnetmap_state *ptns) { @@ -888,6 +882,7 @@ return npriv->nmd->req.nr_arg2; } +/* start ptnetmap mode: send ioctl to the netmap module to create the kthreads */ int ptnetmap_create(struct ptnetmap_state *ptns, struct ptnetmap_cfg *conf) { @@ -919,6 +914,7 @@ return err; } +/* stop ptnetmap mode: send ioctl to the netmap module to delete the kthreads */ int ptnetmap_delete(struct ptnetmap_state *ptns) { @@ -950,7 +946,7 @@ } static struct net_backend ptnbe_backend = { - .name = "ptnetmap|ptvale", + .name = "ptnetmap|ptvale", /* use netmap name with "pt" prefix */ .init = ptnbe_init, .cleanup = ptnbe_cleanup, .send = netmap_send, @@ -962,7 +958,6 @@ DATA_SET(net_backend_set, ptnbe_backend); - /* * make sure a backend is properly initialized */ Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c Thu Aug 13 05:42:56 2015 (r289679) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c Thu Aug 13 09:37:29 2015 (r289680) @@ -28,24 +28,31 @@ __FBSDID("$FreeBSD$"); #include -//#include #include #include #include -//#include -//#include -//#include -//#include + +#include /* IFNAMSIZ */ +#include +#include #include #include + #include "bhyverun.h" #include "pci_emul.h" #include "ptnetmap.h" -#include /* IFNAMSIZ */ -#include -#include +/* + * ptnetmap memdev PCI device + * + * This device is used to map netmap memory allocator (the same allocator can + * be shared between multiple netmap ports) on the guest VM through PCI_BAR. + * + * Each netmap allocator has a unique ID assigned by netmap module. + * + * It is based on QEMU/KVM ptnetmap-memdev implementation. + */ struct ptn_memdev_softc { struct pci_devinst *pi; /* PCI device instance */ @@ -59,7 +66,33 @@ static TAILQ_HEAD(, ptn_memdev_softc) ptn_memdevs = TAILQ_HEAD_INITIALIZER(ptn_memdevs); /* - * find ptn_memdev through mem_id + * ptn_memdev_softc can be created by pe_init or ptnetmap backend, + * this depends on the order of initialization. + */ +static struct ptn_memdev_softc * +ptn_memdev_create() +{ + struct ptn_memdev_softc *sc; + + sc = calloc(1, sizeof(struct ptn_memdev_softc)); + + if (sc != NULL) { + TAILQ_INSERT_TAIL(&ptn_memdevs, sc, next); + } + + return sc; +} + +static void +ptn_memdev_delete(struct ptn_memdev_softc *sc) +{ + TAILQ_REMOVE(&ptn_memdevs, sc, next); + + free(sc); +} + +/* + * Find ptn_memdev through mem_id (netmap memory allocator ID) */ static struct ptn_memdev_softc * ptn_memdev_find_memid(uint16_t mem_id) @@ -76,7 +109,7 @@ } /* - * find ptn_memdev that has not memory + * Find ptn_memdev that has not netmap memory (attached by ptnetmap backend) */ static struct ptn_memdev_softc * ptn_memdev_find_empty_mem() @@ -93,7 +126,7 @@ } /* - * find ptn_memdev that has not PCI device istance + * Find ptn_memdev that has not PCI device istance (created by pe_init) */ static struct ptn_memdev_softc * ptn_memdev_find_empty_pi() @@ -109,28 +142,9 @@ return NULL; } -static struct ptn_memdev_softc * -ptn_memdev_create() -{ - struct ptn_memdev_softc *sc; - - sc = calloc(1, sizeof(struct ptn_memdev_softc)); - - if (sc != NULL) { - TAILQ_INSERT_TAIL(&ptn_memdevs, sc, next); - } - - return sc; -} - -static void -ptn_memdev_delete(struct ptn_memdev_softc *sc) -{ - TAILQ_REMOVE(&ptn_memdevs, sc, next); - - free(sc); -} - +/* + * Handle read on ptnetmap-memdev register + */ static uint64_t ptn_pci_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size) @@ -142,14 +156,12 @@ return 0; if (baridx == PTNETMAP_MEM_PCI_BAR) { - printf("ptnetmap_memdev: unexpected MEM read - offset: %lx size: %d ret: %lx\n", + printf("ptnetmap_memdev: unexpected MEM read - \ + offset: %lx size: %d ret: %lx\n", offset, size, ret); - return 0; /* XXX */ + return 0; } - /* XXX probably should do something better than just assert() */ - assert(baridx == PTNETMAP_IO_PCI_BAR); - switch (offset) { case PTNETMAP_IO_PCI_MEMSIZE: ret = sc->mem_size; @@ -166,6 +178,9 @@ return ret; } +/* + * Handle write on ptnetmap-memdev register (unused for now) + */ static void ptn_pci_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) @@ -176,7 +191,8 @@ return; if (baridx == PTNETMAP_MEM_PCI_BAR) { - printf("ptnetmap_memdev: unexpected MEM write - offset: %lx size: %d value: %lx\n", + printf("ptnetmap_memdev: unexpected MEM write - \ + offset: %lx size: %d value: %lx\n", offset, size, value); return; } @@ -188,31 +204,39 @@ } } +/* + * Configure the ptnetmap-memdev PCI-BARs + * + * Only if the PCI device is created and netmap memory is attached, + * we can create the PCI-BARs. + */ static int -ptn_memdev_configure(struct ptn_memdev_softc *sc) +ptn_memdev_configure_bars(struct ptn_memdev_softc *sc) { int ret; if (sc->pi == NULL || sc->mem_ptr == NULL) return 0; - /* init iobar */ - ret = pci_emul_alloc_bar(sc->pi, PTNETMAP_IO_PCI_BAR, PCIBAR_IO, PTNEMTAP_IO_SIZE); + /* alloc IO-BAR */ + ret = pci_emul_alloc_bar(sc->pi, PTNETMAP_IO_PCI_BAR, PCIBAR_IO, + PTNEMTAP_IO_SIZE); if (ret) { printf("ptnetmap_memdev: iobar allocation error %d\n", ret); return ret; } - - /* init membar */ - /* XXX MEM64 has MEM_PREFETCH */ - ret = pci_emul_alloc_bar(sc->pi, PTNETMAP_MEM_PCI_BAR, PCIBAR_MEM32, sc->mem_size); + /* alloc MEM-BAR */ + ret = pci_emul_alloc_bar(sc->pi, PTNETMAP_MEM_PCI_BAR, PCIBAR_MEM32, + sc->mem_size); if (ret) { printf("ptnetmap_memdev: membar allocation error %d\n", ret); return ret; } - ret = vm_map_user_buf(sc->pi->pi_vmctx, sc->pi->pi_bar[PTNETMAP_MEM_PCI_BAR].addr, + /* map netmap memory on the MEM-BAR */ + ret = vm_map_user_buf(sc->pi->pi_vmctx, + sc->pi->pi_bar[PTNETMAP_MEM_PCI_BAR].addr, sc->mem_size, sc->mem_ptr); if (ret) { printf("ptnetmap_memdev: membar map error %d\n", ret); @@ -222,6 +246,9 @@ return 0; } +/* + * PCI device initialization + */ static int ptn_memdev_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) { @@ -246,10 +273,11 @@ pci_set_cfgdata16(pi, PCIR_VENDOR, PTNETMAP_PCI_VENDOR_ID); pci_set_cfgdata16(pi, PCIR_DEVICE, PTNETMAP_PCI_DEVICE_ID); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_NETWORK); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, 1); /* XXX-ste remove? */ - pci_set_cfgdata16(pi, PCIR_SUBVEND_0, PTNETMAP_PCI_VENDOR_ID); /* XXX-ste remove? */ + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, 1); + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, PTNETMAP_PCI_VENDOR_ID); - ret = ptn_memdev_configure(sc); + /* configure device PCI-BARs */ + ret = ptn_memdev_configure_bars(sc); if (ret) { printf("ptnetmap_memdev: configure error\n"); goto err; @@ -262,6 +290,10 @@ return ret; } +/* + * used by ptnetmap backend to attach the netmap memory allocator to the + * ptnetmap-memdev. (shared with the guest VM through PCI-BAR) + */ int ptn_memdev_attach(void *mem_ptr, uint32_t mem_size, uint16_t mem_id) { @@ -287,8 +319,8 @@ sc->mem_size = mem_size; sc->mem_id = mem_id; - /* configure device BARs */ - ret = ptn_memdev_configure(sc); + /* configure device PCI-BARs */ + ret = ptn_memdev_configure_bars(sc); if (ret) { printf("ptnetmap_memdev: configure error\n"); goto err; Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h Thu Aug 13 05:42:56 2015 (r289679) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h Thu Aug 13 09:37:29 2015 (r289680) @@ -27,6 +27,21 @@ #ifndef __PCI_VIRTIO_PTNETMAP_H__ #define __PCI_VIRTIO_PTNETMAP_H__ +/* + * ptnetmap support for virtio-net (vtnet) pci device. + * + * This file contains functions to use virtio-net device in ptnetmap + * (netmap passthrough) mode and to handle write/read on ptnetmap registers. + * The virtio-net device is used to exchange notification (specific for each + * netmap port), instead the netmap memory is shared through ptnetmap-memdev + * PCI device because multiple netmap port can share the same allocator. + * + * The ptnetmap registers are appended to the virtio configuration + * space (vc_cfgsize). + * + * It is based on QEMU/KVM virtio-ptnetmap implementation. + */ + #ifdef BHYVE_VIRTIO_PTNETMAP #include #include /* VM_LAPIC_MSI */ @@ -37,29 +52,38 @@ /* ptnetmap virtio register BASE */ #define PTNETMAP_VIRTIO_IO_BASE sizeof(struct virtio_net_config) +/* + * Get CSB (Communication Status Block) host address. + * + * The guest allocates the shared CSB and + * write its physical address at CSBAL and CSBAH + * + * We require that writes to the CSB address registers + * are in the order CSBBAH , CSBBAL so on the second one + * we have a valid 64-bit memory address. + * Any previous region is unmapped, and handlers terminated. + * The CSB is then remapped if the new pointer is != 0 + */ static void -ptnetmap_configure_csb(struct vmctx *ctx, struct paravirt_csb** csb, uint32_t csbbal, - uint32_t csbbah) +ptnetmap_configure_csb(struct vmctx *ctx, struct paravirt_csb** csb, + uint32_t csbbal, uint32_t csbbah) { - uint64_t len = 4096; + uint64_t len = NET_PARAVIRT_CSB_SIZE; uint64_t base = ((uint64_t)csbbah << 32) | csbbal; - /* - * We require that writes to the CSB address registers - * are in the order CSBBAH , CSBBAL so on the second one - * we have a valid 64-bit memory address. - * Any previous region is unmapped, and handlers terminated. - * The CSB is then remapped if the new pointer is != 0 - */ - if (*csb) { - *csb = NULL; - } + /* CSB configuration */ if (base) { *csb = paddr_guest2host(ctx, base, len); } } +/* + * Init ptnetmap state on vtnet initialization + * + * Check if the backend supports ptnetmap and extend the virtio + * cfgsize to add ptnetmap register + */ static void pci_vtnet_ptnetmap_init(struct pci_vtnet_softc *sc, struct virtio_consts *vc) { @@ -86,6 +110,10 @@ vc->vc_cfgsize += PTNEMTAP_VIRTIO_IO_SIZE; } +/* + * Expose the required netmap_if fields about the netmap port + * opened in passthrough (ptnetmap) mode to the guest through CSB + */ static int pci_vtnet_ptnetmap_get_mem(struct pci_vtnet_softc *sc) { @@ -111,6 +139,14 @@ return ret; } +/* + * Start ptnetmap mode on virtio-net device + * + * configure virtio TX/RX ring in ptnetmap mode: + * push fake packet per ring to leave enabled the interrupts, + * send I/O guest notification (writes on VTCFG_R_QNOTIFY register) + * directly to ptnetmap kthread and configure the ptnetmap backend. + */ static int pci_vtnet_ptnetmap_up(struct pci_vtnet_softc *sc) { @@ -140,11 +176,11 @@ /* Configure the RX ring */ sc->ptn.cfg.rx_ring.irqfd = vm_get_fd(vmctx); - sc->ptn.cfg.rx_ioctl.com = VM_LAPIC_MSI; + sc->ptn.cfg.rx_ring.ioctl.com = VM_LAPIC_MSI; vq = &sc->vsc_queues[VTNET_RXQ]; mte = &pi->pi_msix.table[vq->vq_msix_idx]; - sc->ptn.cfg.rx_ioctl.data.msg = mte->msg_data; - sc->ptn.cfg.rx_ioctl.data.addr = mte->addr; + sc->ptn.cfg.rx_ring.ioctl.data.msix.msg = mte->msg_data; + sc->ptn.cfg.rx_ring.ioctl.data.msix.addr = mte->addr; /* push fake-elem in the rx queue to enable interrupts */ if (vq_getchain(vq, &idx, iov, 1, NULL) > 0) { vq_relchain(vq, idx, 0); @@ -165,11 +201,11 @@ /* Configure the TX ring */ sc->ptn.cfg.tx_ring.irqfd = vm_get_fd(vmctx); - sc->ptn.cfg.tx_ioctl.com = VM_LAPIC_MSI; + sc->ptn.cfg.tx_ring.ioctl.com = VM_LAPIC_MSI; vq = &sc->vsc_queues[VTNET_TXQ]; mte = &pi->pi_msix.table[vq->vq_msix_idx]; - sc->ptn.cfg.tx_ioctl.data.msg = mte->msg_data; - sc->ptn.cfg.tx_ioctl.data.addr = mte->addr; + sc->ptn.cfg.tx_ring.ioctl.data.msix.msg = mte->msg_data; + sc->ptn.cfg.tx_ring.ioctl.data.msix.addr = mte->addr; /* push fake-elem in the tx queue to enable interrupts */ if (vq_getchain(vq, &idx, iov, 1, NULL) > 0) { vq_relchain(vq, idx, 0); @@ -217,6 +253,11 @@ return (ret); } +/* + * Stop ptnetmap mode on virtio-net device + * + * Restore I/O guest notification. + */ static int pci_vtnet_ptnetmap_down(struct pci_vtnet_softc *sc) { @@ -244,8 +285,12 @@ return (ptnetmap_delete(sc->ptn.state)); } +/* + * Handle write on ptnetmap register and talk with ptnetmap backend + */ static int -pci_vtnet_ptnetmap_write(struct pci_vtnet_softc *sc, int offset, int size, uint32_t value) +pci_vtnet_ptnetmap_write(struct pci_vtnet_softc *sc, int offset, int size, + uint32_t value) { uint32_t *val, ret; @@ -305,8 +350,12 @@ return (0); } +/* + * Handle read on ptnetmap register + */ static int -pci_vtnet_ptnetmap_read(struct pci_vtnet_softc *sc, int offset, int size, uint32_t *value) +pci_vtnet_ptnetmap_read(struct pci_vtnet_softc *sc, int offset, int size, + uint32_t *value) { if (sc->ptn.state == NULL) { printf("ERROR ptnetmap: not supported by backend\n"); @@ -322,7 +371,6 @@ case PTNETMAP_VIRTIO_IO_PTSTS: break; default: - printf("pci_vtnet_ptnentmap: write io reg unexpected\n"); break; } #endif Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/ptnetmap.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/ptnetmap.h Thu Aug 13 05:42:56 2015 (r289679) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/ptnetmap.h Thu Aug 13 09:37:29 2015 (r289680) @@ -27,21 +27,22 @@ #ifndef __PTNETMAP_H__ #define __PTNETMAP_H__ +/* + * ptnetmap state shared between frontend (virtio-net) and ptnetmap backend + */ struct ptnetmap_state { struct net_backend *ptn_be; - /* netmap info */ + /* netmap_if info to share with the guest */ uint32_t offset; uint16_t num_tx_rings; uint16_t num_rx_rings; uint16_t num_tx_slots; uint16_t num_rx_slots; - }; +/* ptnetmap-backend API (used by fronted like virtio-net) */ struct ptnetmap_cfg; - -/* ptnetmap-backend */ uint32_t ptnetmap_get_features(struct ptnetmap_state *ptns, uint32_t features); void ptnetmap_ack_features(struct ptnetmap_state *ptns, uint32_t features); int ptnetmap_get_mem(struct ptnetmap_state *ptns); @@ -49,7 +50,7 @@ int ptnetmap_create(struct ptnetmap_state *ptns, struct ptnetmap_cfg *conf); int ptnetmap_delete(struct ptnetmap_state *ptns); -/* ptnetmap-memdev */ +/* ptnetmap-memdev API (used by ptnetmap backed) */ int ptn_memdev_attach(void *mem_ptr, uint32_t mem_size, uint16_t mem_id); #endif /* __PTNETMAP_H__ */ From owner-svn-soc-all@freebsd.org Thu Aug 13 09:47:14 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2BE099FB02 for ; Thu, 13 Aug 2015 09:47:14 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 922F8145 for ; Thu, 13 Aug 2015 09:47:14 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7D9lERC040515 for ; Thu, 13 Aug 2015 09:47:14 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7D9lCoQ040502 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 09:47:12 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 09:47:12 GMT Message-Id: <201508130947.t7D9lCoQ040502@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289681 - in soc2015/stefano/ptnetmap/stable/10/sys/amd64: include vmm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 09:47:14 -0000 Author: stefano Date: Thu Aug 13 09:47:12 2015 New Revision: 289681 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289681 Log: vmm-ptnetmap: cleanup and documentation Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/include/vmm_dev.h soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.c soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.h soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_usermem.c Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/include/vmm_dev.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/amd64/include/vmm_dev.h Thu Aug 13 09:37:29 2015 (r289680) +++ soc2015/stefano/ptnetmap/stable/10/sys/amd64/include/vmm_dev.h Thu Aug 13 09:47:12 2015 (r289681) @@ -118,13 +118,13 @@ }; struct vm_io_reg_handler { - uint16_t port; - uint16_t in; - uint32_t mask_data; /* 0 means match anything */ - uint32_t data; - enum vm_io_regh_type type; - void *arg; -}; + uint16_t port; /* I/O address */ + uint16_t in; /* 0 out, 1 in */ + uint32_t mask_data; /* 0 means match anything */ + uint32_t data; /* data to match */ + enum vm_io_regh_type type; /* handler type */ + void *arg; /* handler argument */ +};a specific value that mathces struct vm_pptdev_msi { int vcpu; Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.c Thu Aug 13 09:37:29 2015 (r289680) +++ soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.c Thu Aug 13 09:47:12 2015 (r289681) @@ -114,16 +114,26 @@ #define IOPORT_MAX_REG_HANDLER 12 -typedef int (*ioport_reg_handler_func_t)(struct vm *vm, struct ioport_reg_handler *regh, - uint32_t *val); +/* + * ioport_reg_handler functions allows us to to catch VM write/read + * on specific I/O address and send notification. + * + * When the VM writes or reads a specific value on I/O address, if the address + * and the value matches with the info stored durign the handler registration, + * then we send a notification (we can have multiple type of notification, + * but for now is implemented only the VM_IO_REGH_KWEVENTS handler. + */ + +typedef int (*ioport_reg_handler_func_t)(struct vm *vm, + struct ioport_reg_handler *regh, uint32_t *val); struct ioport_reg_handler { - uint16_t port; - uint16_t in; - uint32_t mask_data; - uint32_t data; - ioport_reg_handler_func_t handler; - void *handler_arg; + uint16_t port;i /* I/O address */ + uint16_t in; /* 0 out, 1 in */ + uint32_t mask_data; /* 0 means match anything */ + uint32_t data; /* data to match */ + ioport_reg_handler_func_t handler; /* handler pointer */ + void *handler_arg; /* handler argument */ }; struct ioregh { @@ -134,7 +144,12 @@ /* ----- I/O reg handlers ----- */ -/* VM_IO_REGH_KWEVENTS handler */ +/* + * VM_IO_REGH_KWEVENTS handler + * + * wakeup() on specified address that uniquely identifies the event + * + */ static int vmm_ioport_reg_wakeup(struct vm *vm, struct ioport_reg_handler *regh, uint32_t *val) { @@ -142,9 +157,17 @@ return (0); } +/* + * TODO: + * - VM_IO_REGH_CONDSIGNAL: pthread_cond_signal + * - VM_IO_REGH_WRITEFD: write on fd + * - VM_IO_REGH_IOCTL: ioctl on fd + */ + /* call with ioregh->mtx held */ static struct ioport_reg_handler * -vmm_ioport_find_handler(struct ioregh *ioregh, uint16_t port, uint16_t in, uint32_t mask_data, uint32_t data) +vmm_ioport_find_handler(struct ioregh *ioregh, uint16_t port, uint16_t in, + uint32_t mask_data, uint32_t data) { struct ioport_reg_handler *regh; uint32_t mask; @@ -183,8 +206,8 @@ static int -vmm_ioport_add_handler(struct vm *vm, uint16_t port, uint16_t in, uint32_t mask_data, uint32_t data, - ioport_reg_handler_func_t handler, void *handler_arg) +vmm_ioport_add_handler(struct vm *vm, uint16_t port, uint16_t in, uint32_t mask_data, + uint32_t data, ioport_reg_handler_func_t handler, void *handler_arg) { struct ioport_reg_handler *regh; struct ioregh *ioregh; @@ -196,7 +219,8 @@ regh = vmm_ioport_find_handler(ioregh, port, in, mask_data, data); if (regh != NULL) { - printf("%s: handler for port %d in %d mask_data %d data %d already registered\n", + printf("%s: handler for port %d in %d mask_data %d data %d \ + already registered\n", __FUNCTION__, port, in, mask_data, data); ret = EEXIST; goto err; @@ -222,7 +246,8 @@ } static int -vmm_ioport_del_handler(struct vm *vm, uint16_t port, uint16_t in, uint32_t mask_data, uint32_t data) +vmm_ioport_del_handler(struct vm *vm, uint16_t port, uint16_t in, + uint32_t mask_data, uint32_t data) { struct ioport_reg_handler *regh; struct ioregh *ioregh; @@ -245,9 +270,12 @@ return (ret); } +/* + * register or delete a new I/O event handler. + */ int -vmm_ioport_reg_handler(struct vm *vm, uint16_t port, uint16_t in, uint32_t mask_data, uint32_t data, - enum vm_io_regh_type type, void *arg) +vmm_ioport_reg_handler(struct vm *vm, uint16_t port, uint16_t in, + uint32_t mask_data, uint32_t data, enum vm_io_regh_type type, void *arg) { int ret = 0; @@ -256,7 +284,8 @@ ret = vmm_ioport_del_handler(vm, port, in, mask_data, data); break; case VM_IO_REGH_KWEVENTS: - ret = vmm_ioport_add_handler(vm, port, in, mask_data, data, vmm_ioport_reg_wakeup, arg); + ret = vmm_ioport_add_handler(vm, port, in, mask_data, data, + vmm_ioport_reg_wakeup, arg); break; default: printf("%s: unknown reg_handler type\n", __FUNCTION__); @@ -267,8 +296,12 @@ return (ret); } +/* + * Invoke an handler, if the data matches. + */ static int -invoke_reg_handler(struct vm *vm, int vcpuid, struct vm_exit *vmexit, uint32_t *val, int *error) +invoke_reg_handler(struct vm *vm, int vcpuid, struct vm_exit *vmexit, + uint32_t *val, int *error) { struct ioport_reg_handler *regh; struct ioregh *ioregh; @@ -278,13 +311,12 @@ ioregh = vm_ioregh(vm); IOREGH_LOCK(ioregh); - regh = vmm_ioport_find_handler(ioregh, vmexit->u.inout.port, vmexit->u.inout.in, - mask_data, vmexit->u.inout.eax); + regh = vmm_ioport_find_handler(ioregh, vmexit->u.inout.port, + vmexit->u.inout.in, mask_data, vmexit->u.inout.eax); if (regh == NULL) { IOREGH_UNLOCK(ioregh); return (0); } - /* XXX: maybe is better to use refcount and lock only find */ *error = (*(regh->handler))(vm, regh, val); IOREGH_UNLOCK(ioregh); return (1); Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.h Thu Aug 13 09:37:29 2015 (r289680) +++ soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.h Thu Aug 13 09:47:12 2015 (r289681) @@ -30,7 +30,6 @@ #define _VMM_IOPORT_H_ #define VMM_IOPORT_REG_HANDLER - #ifdef VMM_IOPORT_REG_HANDLER struct ioport_reg_handler; struct ioregh; @@ -38,9 +37,8 @@ struct ioregh *ioregh_init(struct vm *vm); void ioregh_cleanup(struct ioregh *ioregh); -int -vmm_ioport_reg_handler(struct vm *vm, uint16_t port, uint16_t in, uint32_t mask_data, uint32_t data, - enum vm_io_regh_type type, void *arg); +int vmm_ioport_reg_handler(struct vm *vm, uint16_t port, uint16_t in, + uint32_t mask_data, uint32_t data, enum vm_io_regh_type type, void *arg); #else /* !VMM_IOPORT_REG_HANDLER */ #define ioregh_init(_1) (NULL) #define ioregh_cleanup(_1) Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_usermem.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_usermem.c Thu Aug 13 09:37:29 2015 (r289680) +++ soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_usermem.c Thu Aug 13 09:47:12 2015 (r289681) @@ -50,11 +50,20 @@ #include "vmm_mem.h" #include "vmm_usermem.h" +/* + * usermem functions allow us to map an host userspace buffer (eg. from bhyve) + * in the guest VM. + * + * This feature is used to implement ptnetmap on bhyve, mapping the netmap memory + * (returned by the mmap() in the byvhe userspace application) in the guest VM. + */ + +/* TODO: we can create a dynamical list of usermem */ #define MAX_USERMEMS 64 static struct usermem { - struct vmspace *vmspace; /* guest address space */ - vm_paddr_t gpa; + struct vmspace *vmspace; /* guest address space */ + vm_paddr_t gpa; /* guest physical address */ size_t len; } usermems[MAX_USERMEMS]; @@ -128,7 +137,6 @@ error = vm_map_lookup(&map, (unsigned long)buf, VM_PROT_RW, &entry, &obj, &index, &prot, &wired); - printf("---- guest MAP vm_object_t: %p vm_pindex: %ld ----\n", obj, index); /* map th vm_object in the vmspace */ if (obj != NULL) { error = vm_map_find(&vmspace->vm_map, obj, index, &gpa, len, 0, From owner-svn-soc-all@freebsd.org Thu Aug 13 10:36:47 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 361639B7B25 for ; Thu, 13 Aug 2015 10:36:47 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2550A765 for ; Thu, 13 Aug 2015 10:36:47 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7DAalxg052043 for ; Thu, 13 Aug 2015 10:36:47 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7DAajKO051949 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 10:36:45 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 10:36:45 GMT Message-Id: <201508131036.t7DAajKO051949@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289682 - in soc2015/stefano/ptnetmap/stable/10/sys: dev/netmap net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 10:36:47 -0000 Author: stefano Date: Thu Aug 13 10:36:44 2015 New Revision: 289682 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289682 Log: [ptnetmap] sync netmap code with github version ptnetmap comments and cleanup Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_lem_netmap.h soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_vtnet_netmap.h soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_freebsd.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_generic.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_kern.h soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_mbq.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_mbq.h soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_mem2.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_mem2.h soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_monitor.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_offloadings.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_pipe.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_vale.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_virt.h soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/ptnetmap.c soc2015/stefano/ptnetmap/stable/10/sys/net/netmap.h soc2015/stefano/ptnetmap/stable/10/sys/net/netmap_user.h Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_lem_netmap.h Thu Aug 13 09:47:12 2015 (r289681) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_lem_netmap.h Thu Aug 13 10:36:44 2015 (r289682) @@ -472,8 +472,14 @@ } #if defined (NIC_PTNETMAP) && defined (WITH_PTNETMAP_GUEST) +/* + * ptnetmap support for: lem (FreeBSD version) + * + * For details on ptnetmap support please see if_vtnet_netmap.h + */ static uint32_t lem_ptnetmap_ptctl(struct ifnet *, uint32_t); +/* Returns device configuration from the CSB */ static int lem_ptnetmap_config(struct netmap_adapter *na, u_int *txr, u_int *txd, u_int *rxr, u_int *rxd) @@ -501,6 +507,7 @@ return 0; } +/* Reconcile host and guest view of the transmit ring. */ static int lem_ptnetmap_txsync(struct netmap_kring *kring, int flags) { @@ -510,7 +517,7 @@ struct adapter *adapter = ifp->if_softc; int ret, notify = 0; - ret = ptnetmap_txsync(kring, flags, ¬ify); + ret = netmap_pt_guest_txsync(kring, flags, ¬ify); if (notify) E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), 0); @@ -518,6 +525,7 @@ return ret; } +/* Reconcile host and guest view of the receive ring. */ static int lem_ptnetmap_rxsync(struct netmap_kring *kring, int flags) { @@ -527,7 +535,7 @@ struct adapter *adapter = ifp->if_softc; int ret, notify = 0; - ret = ptnetmap_rxsync(kring, flags, ¬ify); + ret = netmap_pt_guest_rxsync(kring, flags, ¬ify); if (notify) E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), 0); @@ -535,6 +543,7 @@ return ret; } +/* Register/unregister. We are already under netmap lock. */ static int lem_ptnetmap_reg(struct netmap_adapter *na, int onoff) { @@ -555,8 +564,8 @@ * Init ring and kring pointers * After PARAVIRT_PTCTL_REGIF, the csb contains a snapshot of a * host kring pointers. - * XXX This initialization is required, because we don't close the - * host port on UNREGIF. + * XXX This initialization is required, because we don't close + * the host port on UNREGIF. */ // Init rx ring @@ -564,14 +573,16 @@ kring->rhead = kring->ring->head = csb->rx_ring.head; kring->rcur = kring->ring->cur = csb->rx_ring.cur; kring->nr_hwcur = csb->rx_ring.hwcur; - kring->nr_hwtail = kring->rtail = kring->ring->tail = csb->rx_ring.hwtail; + kring->nr_hwtail = kring->rtail = kring->ring->tail = + csb->rx_ring.hwtail; // Init tx ring kring = na->tx_rings; kring->rhead = kring->ring->head = csb->tx_ring.head; kring->rcur = kring->ring->cur = csb->tx_ring.cur; kring->nr_hwcur = csb->tx_ring.hwcur; - kring->nr_hwtail = kring->rtail = kring->ring->tail = csb->tx_ring.hwtail; + kring->nr_hwtail = kring->rtail = kring->ring->tail = + csb->tx_ring.hwtail; } else { na->na_flags &= ~NAF_NETMAP_ON; adapter->ptnetmap_enabled = 0; @@ -588,15 +599,21 @@ return EOPNOTSUPP; } +/* + * CSB (Communication Status Block) setup + * CSB is already allocated in if_lem (paravirt). + */ static void lem_ptnetmap_setup_csb(struct adapter *adapter) { struct ifnet *ifp = adapter->ifp; - struct netmap_pt_guest_adapter* ptna = (struct netmap_pt_guest_adapter *)NA(ifp); + struct netmap_pt_guest_adapter* ptna = + (struct netmap_pt_guest_adapter *)NA(ifp); ptna->csb = adapter->csb; } +/* Send command to the host through PTCTL register. */ static uint32_t lem_ptnetmap_ptctl(struct ifnet *ifp, uint32_t val) { @@ -610,8 +627,7 @@ return ret; } - - +/* Features negotiation with the host through PTFEAT */ static uint32_t lem_ptnetmap_features(struct adapter *adapter) { Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_vtnet_netmap.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_vtnet_netmap.h Thu Aug 13 09:47:12 2015 (r289681) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_vtnet_netmap.h Thu Aug 13 10:36:44 2015 (r289682) @@ -35,7 +35,8 @@ #ifdef WITH_PTNETMAP_GUEST #include static int vtnet_ptnetmap_txsync(struct netmap_kring *kring, int flags); -#define VTNET_PTNETMAP_ON(_na) ((nm_netmap_on(_na)) && ((_na)->nm_txsync == vtnet_ptnetmap_txsync)) +#define VTNET_PTNETMAP_ON(_na) \ + ((nm_netmap_on(_na)) && ((_na)->nm_txsync == vtnet_ptnetmap_txsync)) #else /* !WITH_PTNETMAP_GUEST */ #define VTNET_PTNETMAP_ON(_na) 0 #endif /* WITH_PTNETMAP_GUEST */ @@ -414,9 +415,20 @@ } #ifdef WITH_PTNETMAP_GUEST +/* + * ptnetmap support for: virtio-net (FreeBSD version) + * + * this part od this file is meant to be a reference on how to implement + * ptnetmap support for a network driver. + * this file contains code but only static or inline functions used + * by a single driver. + */ + +/* + * virtio-specific macro and fucntions + */ /* ptnetmap virtio register BASE */ #define PTNETMAP_VIRTIO_IO_BASE sizeof(struct virtio_net_config) - #ifndef VIRTIO_NET_F_PTNETMAP #define VIRTIO_NET_F_PTNETMAP 0x2000000 /* linux/qeum 25 */ #endif /* VIRTIO_NET_F_PTNETMAP */ @@ -425,9 +437,13 @@ vtnet_ptnetmap_iowrite4(device_t dev, uint32_t addr, uint32_t val) { int i; - /* virtio_pci config_set use multiple iowrite8, we need to split the call and reverse the order */ + /* + * virtio_pci config_set use multiple iowrite8, we need to split the + * call and reverse the order + */ for (i = 3; i >= 0; i--) { - virtio_write_dev_config_1(dev, PTNETMAP_VIRTIO_IO_BASE + addr + i, *(((uint8_t *)&val) + i)); + virtio_write_dev_config_1(dev, PTNETMAP_VIRTIO_IO_BASE + addr + i, + *(((uint8_t *)&val) + i)); } } @@ -438,25 +454,35 @@ int i; for (i = 0; i <= 3; i++) { - *(((uint8_t *)&val) + i) = virtio_read_dev_config_1(dev, PTNETMAP_VIRTIO_IO_BASE + addr + i); + *(((uint8_t *)&val) + i) = virtio_read_dev_config_1(dev, + PTNETMAP_VIRTIO_IO_BASE + addr + i); } return val; } +/* + * CSB (Communication Status Block) allocation. + * CSB is the shared memory used by the netmap instance running in the guest + * and the ptnetmap kthreads in the host. + * The CSBBAH/CSBBAL registers must be added to the virtio-net device. + * + * Only called after netmap_pt_guest_attach(). + */ static int vtnet_ptnetmap_alloc_csb(struct SOFTC_T *sc) { device_t dev = sc->vtnet_dev; struct ifnet *ifp = sc->vtnet_ifp; - struct netmap_pt_guest_adapter* ptna = (struct netmap_pt_guest_adapter *)NA(ifp); + struct netmap_pt_guest_adapter* ptna = + (struct netmap_pt_guest_adapter *)NA(ifp); vm_paddr_t csb_phyaddr; if (ptna->csb) return 0; - ptna->csb = contigmalloc(NET_PARAVIRT_CSB_SIZE, M_DEVBUF, M_NOWAIT | M_ZERO, - (size_t)0, -1UL, PAGE_SIZE, 0); + ptna->csb = contigmalloc(NET_PARAVIRT_CSB_SIZE, M_DEVBUF, + M_NOWAIT | M_ZERO, (size_t)0, -1UL, PAGE_SIZE, 0); if (!ptna->csb) { D("Communication Status Block allocation failed!"); return ENOMEM; @@ -467,18 +493,24 @@ ptna->csb->guest_csb_on = 1; /* Tell the device the CSB physical address. */ - vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_CSBBAH, (uint32_t)(csb_phyaddr >> 32)); - vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_CSBBAL, (uint32_t)(csb_phyaddr)); + vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_CSBBAH, + (uint32_t)(csb_phyaddr >> 32)); + vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_CSBBAL, + (uint32_t)(csb_phyaddr)); return 0; } +/* + * CSB (Communication Status Block) deallocation. + */ static void vtnet_ptnetmap_free_csb(struct SOFTC_T *sc) { device_t dev = sc->vtnet_dev; struct ifnet *ifp = sc->vtnet_ifp; - struct netmap_pt_guest_adapter* ptna = (struct netmap_pt_guest_adapter *)NA(ifp); + struct netmap_pt_guest_adapter* ptna = + (struct netmap_pt_guest_adapter *)NA(ifp); if (ptna->csb) { /* CSB deallocation protocol. */ @@ -491,11 +523,19 @@ } static uint32_t vtnet_ptnetmap_ptctl(struct ifnet *, uint32_t); + +/* + * Returns device configuration from the CSB, after sending the PTCTL_CONFIG + * command to the host (hypervisor virtio fronted). + * The host reads the configuration from the netmap port (opened in the host) + * and it stores the values in the CSB. + */ static int vtnet_ptnetmap_config(struct netmap_adapter *na, u_int *txr, u_int *txd, u_int *rxr, u_int *rxd) { - struct netmap_pt_guest_adapter *ptna = (struct netmap_pt_guest_adapter *)na; + struct netmap_pt_guest_adapter *ptna = + (struct netmap_pt_guest_adapter *)na; struct paravirt_csb *csb = ptna->csb; int ret; @@ -511,11 +551,16 @@ *txd = csb->num_tx_slots; *rxd = csb->num_rx_slots; - D("txr %u rxr %u txd %u rxd %u", + ND("txr %u rxr %u txd %u rxd %u", *txr, *rxr, *txd, *rxd); return 0; } +/* + * Reconcile host and guest view of the transmit ring. + * Use generic netmap_pt_guest_txsync(). + * Only the notification to the host is device-specific. + */ static int vtnet_ptnetmap_txsync(struct netmap_kring *kring, int flags) { @@ -526,7 +571,7 @@ struct virtqueue *vq = sc->vtnet_txqs[ring_nr].vtntx_vq; int ret, notify = 0; - ret = ptnetmap_txsync(kring, flags, ¬ify); + ret = netmap_pt_guest_txsync(kring, flags, ¬ify); if (notify) virtqueue_notify(vq); @@ -536,6 +581,11 @@ return ret; } +/* + * Reconcile host and guest view of the receive ring. + * Use generic netmap_pt_guest_rxsync(). + * Only the notification to the host is device-specific. + */ static int vtnet_ptnetmap_rxsync(struct netmap_kring *kring, int flags) { @@ -546,7 +596,7 @@ struct virtqueue *vq = sc->vtnet_rxqs[ring_nr].vtnrx_vq; int ret, notify = 0; - ret = ptnetmap_rxsync(kring, flags, ¬ify); + ret = netmap_pt_guest_rxsync(kring, flags, ¬ify); if (notify) virtqueue_notify(vq); @@ -556,10 +606,15 @@ return ret; } +/* + * Register/unregister. We are already under netmap lock. + * Only called on the first register or the last unregister. + */ static int vtnet_ptnetmap_reg(struct netmap_adapter *na, int onoff) { - struct netmap_pt_guest_adapter *ptna = (struct netmap_pt_guest_adapter *)na; + struct netmap_pt_guest_adapter *ptna = + (struct netmap_pt_guest_adapter *)na; /* device-specific */ struct ifnet *ifp = na->ifp; @@ -597,22 +652,24 @@ * Init ring and kring pointers * After PARAVIRT_PTCTL_REGIF, the csb contains a snapshot of a * host kring pointers. - * XXX This initialization is required, because we don't close the - * host port on UNREGIF. + * XXX This initialization is required, because we don't close + * the host port on UNREGIF. */ // Init rx ring kring = na->rx_rings; kring->rhead = kring->ring->head = csb->rx_ring.head; kring->rcur = kring->ring->cur = csb->rx_ring.cur; kring->nr_hwcur = csb->rx_ring.hwcur; - kring->nr_hwtail = kring->rtail = kring->ring->tail = csb->rx_ring.hwtail; + kring->nr_hwtail = kring->rtail = kring->ring->tail = + csb->rx_ring.hwtail; // Init tx ring kring = na->tx_rings; kring->rhead = kring->ring->head = csb->tx_ring.head; kring->rcur = kring->ring->cur = csb->tx_ring.cur; kring->nr_hwcur = csb->tx_ring.hwcur; - kring->nr_hwtail = kring->rtail = kring->ring->tail = csb->tx_ring.hwtail; + kring->nr_hwtail = kring->rtail = kring->ring->tail = + csb->tx_ring.hwtail; } else { ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); //na->na_flags &= ~NAF_NETMAP_ON; @@ -631,6 +688,10 @@ return EOPNOTSUPP; } +/* + * Send command to the host (hypervisor virtio fronted) through PTCTL register. + * The PTCTL register must be added to the virtio-net device. + */ static uint32_t vtnet_ptnetmap_ptctl(struct ifnet *ifp, uint32_t val) { @@ -646,13 +707,19 @@ return ret; } +/* + * Features negotiation with the host (hypervisor virtio fronted) through PTFEAT + * register. + * The PTFEAT register must be added to the virtio-net device. + */ static uint32_t vtnet_ptnetmap_features(struct SOFTC_T *sc) { device_t dev = sc->vtnet_dev; uint32_t features; /* tell the device the features we support */ - vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_PTFEAT, NET_PTN_FEATURES_BASE); + vtnet_ptnetmap_iowrite4(dev, PTNETMAP_VIRTIO_IO_PTFEAT, + NET_PTN_FEATURES_BASE); /* get back the acknowledged features */ features = vtnet_ptnetmap_ioread4(dev, PTNETMAP_VIRTIO_IO_PTFEAT); D("ptnetmap support: %s\n", @@ -692,9 +759,9 @@ na.num_tx_rings = na.num_rx_rings = sc->vtnet_max_vq_pairs; D("max rings %d", sc->vtnet_max_vq_pairs); #ifdef WITH_PTNETMAP_GUEST - D("check ptnetmap support"); + /* check if virtio-net (guest and host) supports ptnetmap */ if (virtio_with_feature(sc->vtnet_dev, VIRTIO_NET_F_PTNETMAP) && - (vtnet_ptnetmap_features(sc) & NET_PTN_FEATURES_BASE)) { + (vtnet_ptnetmap_features(sc) & NET_PTN_FEATURES_BASE)) { D("ptnetmap supported"); na.nm_config = vtnet_ptnetmap_config; na.nm_register = vtnet_ptnetmap_reg; Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap.c Thu Aug 13 09:47:12 2015 (r289681) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap.c Thu Aug 13 10:36:44 2015 (r289682) @@ -133,13 +133,12 @@ * > select()able file descriptor on which events are reported. * * Internally, we allocate a netmap_priv_d structure, that will be - * initialized on ioctl(NIOCREGIF). + * initialized on ioctl(NIOCREGIF). There is one netmap_priv_d + * structure for each open(). * * os-specific: - * FreeBSD: netmap_open (netmap_freebsd.c). The priv is - * per-thread. - * linux: linux_netmap_open (netmap_linux.c). The priv is - * per-open. + * FreeBSD: see netmap_open() (netmap_freebsd.c) + * linux: see linux_netmap_open() (netmap_linux.c) * * > 2. on each descriptor, the process issues an ioctl() to identify * > the interface that should report events to the file descriptor. @@ -306,7 +305,7 @@ * kring->nm_sync() == netmap_txsync_to_host_compat * netmap_txsync_to_host(na) * NM_SEND_UP() - * FreeBSD: na->if_input() == ?? XXX + * FreeBSD: na->if_input() == ether_input() * linux: netif_rx() with NM_MAGIC_PRIORITY_RX * * @@ -333,7 +332,7 @@ * generic_rx_handler() * mbq_safe_enqueue() * na->nm_notify() == netmap_notify() - * - rx from host stack: + * - rx from host stack (XXX why different from native?): * concurrently: * 1) host stack * linux: generic_ndo_start_xmit() @@ -344,13 +343,7 @@ * 2) ioctl(NIOCRXSYNC)/netmap_poll() in process context * kring->nm_sync() == netmap_rxsync_from_host_compat * netmap_rxsync_from_host(na, NULL, NULL) - * - tx to host stack: - * ioctl(NIOCTXSYNC)/netmap_poll() in process context - * kring->nm_sync() == netmap_txsync_to_host_compat - * netmap_txsync_to_host(na) - * NM_SEND_UP() - * FreeBSD: na->if_input() == ??? XXX - * linux: netif_rx() with NM_MAGIC_PRIORITY_RX + * - tx to host stack (same as native): * * * -= VALE =- @@ -464,20 +457,19 @@ knlist_init_mtx(&(x)->si.si_note, m); \ } while (0) -#define OS_selrecord(a, b) selrecord(a, &((b)->si)) -#define OS_selwakeup(a, b) freebsd_selwakeup(a, b) - #elif defined(linux) #include "bsd_glue.h" - - #elif defined(__APPLE__) #warning OSX support is only partial #include "osx_glue.h" +#elif defined (_WIN32) + +#include "win_glue.h" + #else #error Unsupported platform @@ -492,39 +484,22 @@ #include -MALLOC_DEFINE(M_NETMAP, "netmap", "Network memory map"); - /* user-controlled variables */ int netmap_verbose; static int netmap_no_timestamp; /* don't timestamp on rxsync */ - -SYSCTL_NODE(_dev, OID_AUTO, netmap, CTLFLAG_RW, 0, "Netmap args"); -SYSCTL_INT(_dev_netmap, OID_AUTO, verbose, - CTLFLAG_RW, &netmap_verbose, 0, "Verbose mode"); -SYSCTL_INT(_dev_netmap, OID_AUTO, no_timestamp, - CTLFLAG_RW, &netmap_no_timestamp, 0, "no_timestamp"); int netmap_mitigate = 1; -SYSCTL_INT(_dev_netmap, OID_AUTO, mitigate, CTLFLAG_RW, &netmap_mitigate, 0, ""); int netmap_no_pendintr = 1; -SYSCTL_INT(_dev_netmap, OID_AUTO, no_pendintr, - CTLFLAG_RW, &netmap_no_pendintr, 0, "Always look for new received packets."); int netmap_txsync_retry = 2; -SYSCTL_INT(_dev_netmap, OID_AUTO, txsync_retry, CTLFLAG_RW, - &netmap_txsync_retry, 0 , "Number of txsync loops in bridge's flush."); - int netmap_adaptive_io = 0; -SYSCTL_INT(_dev_netmap, OID_AUTO, adaptive_io, CTLFLAG_RW, - &netmap_adaptive_io, 0 , "Adaptive I/O on paravirt"); - int netmap_flags = 0; /* debug flags */ -int netmap_fwd = 0; /* force transparent mode */ +static int netmap_fwd = 0; /* force transparent mode */ /* * netmap_admode selects the netmap mode to use. * Invalid values are reset to NETMAP_ADMODE_BEST */ -enum { NETMAP_ADMODE_BEST = 0, /* use native, fallback to generic */ +enum { NETMAP_ADMODE_BEST = 0, /* use native, fallback to generic */ NETMAP_ADMODE_NATIVE, /* either native or none */ NETMAP_ADMODE_GENERIC, /* force generic */ NETMAP_ADMODE_LAST }; @@ -534,6 +509,26 @@ int netmap_generic_ringsize = 1024; /* Generic ringsize. */ int netmap_generic_rings = 1; /* number of queues in generic. */ +/* + * SYSCTL calls are grouped between SYSBEGIN and SYSEND to be emulated + * in some other operating systems + */ +SYSBEGIN(main_init); + +SYSCTL_DECL(_dev_netmap); +SYSCTL_NODE(_dev, OID_AUTO, netmap, CTLFLAG_RW, 0, "Netmap args"); +SYSCTL_INT(_dev_netmap, OID_AUTO, verbose, + CTLFLAG_RW, &netmap_verbose, 0, "Verbose mode"); +SYSCTL_INT(_dev_netmap, OID_AUTO, no_timestamp, + CTLFLAG_RW, &netmap_no_timestamp, 0, "no_timestamp"); +SYSCTL_INT(_dev_netmap, OID_AUTO, mitigate, CTLFLAG_RW, &netmap_mitigate, 0, ""); +SYSCTL_INT(_dev_netmap, OID_AUTO, no_pendintr, + CTLFLAG_RW, &netmap_no_pendintr, 0, "Always look for new received packets."); +SYSCTL_INT(_dev_netmap, OID_AUTO, txsync_retry, CTLFLAG_RW, + &netmap_txsync_retry, 0 , "Number of txsync loops in bridge's flush."); +SYSCTL_INT(_dev_netmap, OID_AUTO, adaptive_io, CTLFLAG_RW, + &netmap_adaptive_io, 0 , "Adaptive I/O on paravirt"); + SYSCTL_INT(_dev_netmap, OID_AUTO, flags, CTLFLAG_RW, &netmap_flags, 0 , ""); SYSCTL_INT(_dev_netmap, OID_AUTO, fwd, CTLFLAG_RW, &netmap_fwd, 0 , ""); SYSCTL_INT(_dev_netmap, OID_AUTO, admode, CTLFLAG_RW, &netmap_admode, 0 , ""); @@ -541,6 +536,8 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, generic_ringsize, CTLFLAG_RW, &netmap_generic_ringsize, 0 , ""); SYSCTL_INT(_dev_netmap, OID_AUTO, generic_rings, CTLFLAG_RW, &netmap_generic_rings, 0 , ""); +SYSEND; + NMG_LOCK_T netmap_global_lock; int netmap_use_count = 0; /* number of active netmap instances */ @@ -728,7 +725,7 @@ } static void netmap_txsync_to_host(struct netmap_adapter *na); -static int netmap_rxsync_from_host(struct netmap_adapter *na, struct thread *td, void *pwait); +static int netmap_rxsync_from_host(struct netmap_adapter *na, NM_SELRECORD_T *); /* kring->nm_sync callback for the host tx ring */ static int @@ -744,7 +741,7 @@ netmap_rxsync_from_host_compat(struct netmap_kring *kring, int flags) { (void)flags; /* unused */ - netmap_rxsync_from_host(kring->na, NULL, NULL); + netmap_rxsync_from_host(kring->na, NULL); return 0; } @@ -1036,13 +1033,18 @@ netmap_send_up(struct ifnet *dst, struct mbq *q) { struct mbuf *m; + struct mbuf *head = NULL, *prev = NULL; /* send packets up, outside the lock */ while ((m = mbq_dequeue(q)) != NULL) { if (netmap_verbose & NM_VERB_HOST) D("sending up pkt %p size %d", m, MBUF_LEN(m)); - NM_SEND_UP(dst, m); + prev = nm_os_send_up(dst, m, prev); + if (head == NULL) + head = prev; } + if (head) + nm_os_send_up(dst, NULL, head); mbq_destroy(q); } @@ -1179,7 +1181,7 @@ * transparent mode, or a negative value if error */ static int -netmap_rxsync_from_host(struct netmap_adapter *na, struct thread *td, void *pwait) +netmap_rxsync_from_host(struct netmap_adapter *na, NM_SELRECORD_T *sr) { struct netmap_kring *kring = &na->rx_rings[na->num_rx_rings]; struct netmap_ring *ring = kring->ring; @@ -1189,9 +1191,6 @@ int ret = 0; struct mbq *q = &kring->rx_queue, fq; - (void)pwait; /* disable unused warnings */ - (void)td; - mbq_init(&fq); /* fq holds packets to be freed */ mbq_lock(q); @@ -1232,8 +1231,8 @@ } /* access copies of cur,tail in the kring */ - if (kring->rcur == kring->rtail && td) /* no bufs available */ - OS_selrecord(td, &kring->si); + if (kring->rcur == kring->rtail && sr) /* no bufs available */ + nm_os_selrecord(sr, &kring->si); mbq_unlock(q); @@ -2078,21 +2077,16 @@ * Return 0 on success, errno otherwise. */ int -netmap_ioctl(struct cdev *dev, u_long cmd, caddr_t data, - int fflag, struct thread *td) +netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, struct thread *td) { - struct netmap_priv_d *priv = NULL; struct nmreq *nmr = (struct nmreq *) data; struct netmap_adapter *na = NULL; - int error; + int error = 0; u_int i, qfirst, qlast; struct netmap_if *nifp; struct netmap_kring *krings; enum txrx t; - (void)dev; /* UNUSED */ - (void)fflag; /* UNUSED */ - if (cmd == NIOCGINFO || cmd == NIOCREGIF) { /* truncate name */ nmr->nr_name[sizeof(nmr->nr_name) - 1] = '\0'; @@ -2107,15 +2101,6 @@ return EINVAL; } } - CURVNET_SET(TD_TO_VNET(td)); - - error = devfs_get_cdevpriv((void **)&priv); - if (error) { - CURVNET_RESTORE(); - /* XXX ENOENT should be impossible, since the priv - * is now created in the open */ - return (error == ENOENT ? ENXIO : error); - } switch (cmd) { case NIOCGINFO: /* return capabilities etc */ @@ -2335,7 +2320,6 @@ } out: - CURVNET_RESTORE(); return (error); } @@ -2355,9 +2339,8 @@ * hidden argument. */ int -netmap_poll(struct cdev *dev, int events, struct thread *td) +netmap_poll(struct netmap_priv_d *priv, int events, NM_SELRECORD_T *sr) { - struct netmap_priv_d *priv = NULL; struct netmap_adapter *na; struct netmap_kring *kring; struct netmap_ring *ring; @@ -2365,8 +2348,6 @@ #define want_tx want[NR_TX] #define want_rx want[NR_RX] struct mbq q; /* packets from hw queues to host stack */ - void *pwait = dev; /* linux compatibility */ - int is_kevent = 0; enum txrx t; /* @@ -2376,24 +2357,8 @@ */ int retry_tx = 1, retry_rx = 1; - (void)pwait; mbq_init(&q); - /* - * XXX kevent has curthread->tp_fop == NULL, - * so devfs_get_cdevpriv() fails. We circumvent this by passing - * priv as the first argument, which is also useful to avoid - * the selrecord() which are not necessary in that case. - */ - if (devfs_get_cdevpriv((void **)&priv) != 0) { - is_kevent = 1; - if (netmap_verbose) - D("called from kevent"); - priv = (struct netmap_priv_d *)dev; - } - if (priv == NULL) - return POLLERR; - if (priv->np_nifp == NULL) { D("No if registered"); return POLLERR; @@ -2501,8 +2466,8 @@ kring->nm_notify(kring, 0); } } - if (want_tx && retry_tx && !is_kevent) { - OS_selrecord(td, check_all_tx ? + if (want_tx && retry_tx && sr) { + nm_os_selrecord(sr, check_all_tx ? &na->si[NR_TX] : &na->tx_rings[priv->np_qfirst[NR_TX]].si); retry_tx = 0; goto flush_tx; @@ -2572,14 +2537,14 @@ && (netmap_fwd || ring->flags & NR_FORWARD)) { /* XXX fix to use kring fields */ if (nm_ring_empty(ring)) - send_down = netmap_rxsync_from_host(na, td, dev); + send_down = netmap_rxsync_from_host(na, sr); if (!nm_ring_empty(ring)) revents |= want_rx; } } - if (retry_rx && !is_kevent) - OS_selrecord(td, check_all_rx ? + if (retry_rx && sr) + nm_os_selrecord(sr, check_all_rx ? &na->si[NR_RX] : &na->rx_rings[priv->np_qfirst[NR_RX]].si); if (send_down > 0 || retry_rx) { retry_rx = 0; @@ -2622,13 +2587,13 @@ struct netmap_adapter *na = kring->na; enum txrx t = kring->tx; - OS_selwakeup(&kring->si, PI_NET); + nm_os_selwakeup(&kring->si); /* optimization: avoid a wake up on the global * queue if nobody has registered for more * than one ring */ if (na->si_users[t] > 0) - OS_selwakeup(&na->si[t], PI_NET); + nm_os_selwakeup(&na->si[t]); return 0; } @@ -3199,7 +3164,7 @@ goto fail; #ifdef __FreeBSD__ - nm_vi_init_index(); + nm_os_vi_init_index(); #endif printf("netmap: loaded module\n"); Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_freebsd.c Thu Aug 13 09:47:12 2015 (r289681) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_freebsd.c Thu Aug 13 10:36:44 2015 (r289682) @@ -73,7 +73,7 @@ /* ======================== FREEBSD-SPECIFIC ROUTINES ================== */ rawsum_t -nm_csum_raw(uint8_t *data, size_t len, rawsum_t cur_sum) +nm_os_csum_raw(uint8_t *data, size_t len, rawsum_t cur_sum) { /* TODO XXX please use the FreeBSD implementation for this. */ uint16_t *words = (uint16_t *)data; @@ -93,7 +93,7 @@ * return value is in network byte order. */ uint16_t -nm_csum_fold(rawsum_t cur_sum) +nm_os_csum_fold(rawsum_t cur_sum) { /* TODO XXX please use the FreeBSD implementation for this. */ while (cur_sum >> 16) @@ -102,17 +102,17 @@ return htobe16((~cur_sum) & 0xFFFF); } -uint16_t nm_csum_ipv4(struct nm_iphdr *iph) +uint16_t nm_os_csum_ipv4(struct nm_iphdr *iph) { #if 0 return in_cksum_hdr((void *)iph); #else - return nm_csum_fold(nm_csum_raw((uint8_t*)iph, sizeof(struct nm_iphdr), 0)); + return nm_os_csum_fold(nm_os_csum_raw((uint8_t*)iph, sizeof(struct nm_iphdr), 0)); #endif } void -nm_csum_tcpudp_ipv4(struct nm_iphdr *iph, void *data, +nm_os_csum_tcpudp_ipv4(struct nm_iphdr *iph, void *data, size_t datalen, uint16_t *check) { #ifdef INET @@ -124,7 +124,7 @@ /* Compute the checksum on TCP/UDP header + payload * (includes the pseudo-header). */ - *check = nm_csum_fold(nm_csum_raw(data, datalen, 0)); + *check = nm_os_csum_fold(nm_csum_raw(data, datalen, 0)); #else static int notsupported = 0; if (!notsupported) { @@ -135,12 +135,12 @@ } void -nm_csum_tcpudp_ipv6(struct nm_ipv6hdr *ip6h, void *data, +nm_os_csum_tcpudp_ipv6(struct nm_ipv6hdr *ip6h, void *data, size_t datalen, uint16_t *check) { #ifdef INET6 *check = in6_cksum_pseudo((void*)ip6h, datalen, ip6h->nexthdr, 0); - *check = nm_csum_fold(nm_csum_raw(data, datalen, 0)); + *check = nm_os_csum_fold(nm_csum_raw(data, datalen, 0)); #else static int notsupported = 0; if (!notsupported) { @@ -150,13 +150,21 @@ #endif } +/* on FreeBSD we send up one packet at a time */ +void * +nm_os_send_up(struct ifnet *ifp, struct mbuf *m, struct mbuf *prev) +{ + + NA(ifp)->if_input(ifp, m); + return NULL; +} /* * Intercept the rx routine in the standard device driver. * Second argument is non-zero to intercept, 0 to restore */ int -netmap_catch_rx(struct netmap_generic_adapter *gna, int intercept) +nm_os_catch_rx(struct netmap_generic_adapter *gna, int intercept) { struct netmap_adapter *na = &gna->up.up; struct ifnet *ifp = na->ifp; @@ -188,7 +196,7 @@ * On freebsd we just intercept if_transmit. */ void -netmap_catch_tx(struct netmap_generic_adapter *gna, int enable) +nm_os_catch_tx(struct netmap_generic_adapter *gna, int enable) { struct netmap_adapter *na = &gna->up.up; struct ifnet *ifp = netmap_generic_getifp(gna); @@ -219,7 +227,7 @@ * */ int -generic_xmit_frame(struct ifnet *ifp, struct mbuf *m, +nm_os_generic_xmit_frame(struct ifnet *ifp, struct mbuf *m, void *addr, u_int len, u_int ring_nr) { int ret; @@ -269,7 +277,7 @@ * way to extract the info from the ifp */ int -generic_find_num_desc(struct ifnet *ifp, unsigned int *tx, unsigned int *rx) +nm_os_generic_find_num_desc(struct ifnet *ifp, unsigned int *tx, unsigned int *rx) { D("called, in tx %d rx %d", *tx, *rx); return 0; @@ -277,7 +285,7 @@ void -generic_find_num_queues(struct ifnet *ifp, u_int *txq, u_int *rxq) +nm_os_generic_find_num_queues(struct ifnet *ifp, u_int *txq, u_int *rxq) { D("called, in txq %d rxq %d", *txq, *rxq); *txq = netmap_generic_rings; @@ -286,7 +294,7 @@ void -netmap_mitigation_init(struct nm_generic_mit *mit, int idx, struct netmap_adapter *na) +nm_os_mitigation_init(struct nm_generic_mit *mit, int idx, struct netmap_adapter *na) { ND("called"); mit->mit_pending = 0; @@ -296,21 +304,21 @@ void -netmap_mitigation_start(struct nm_generic_mit *mit) +nm_os_mitigation_start(struct nm_generic_mit *mit) { ND("called"); } void -netmap_mitigation_restart(struct nm_generic_mit *mit) +nm_os_mitigation_restart(struct nm_generic_mit *mit) { ND("called"); } int -netmap_mitigation_active(struct nm_generic_mit *mit) +nm_os_mitigation_active(struct nm_generic_mit *mit) { ND("called"); return 0; @@ -318,7 +326,7 @@ void -netmap_mitigation_cleanup(struct nm_generic_mit *mit) +nm_os_mitigation_cleanup(struct nm_generic_mit *mit) { ND("called"); } @@ -348,7 +356,7 @@ } nm_vi_indices; void -nm_vi_init_index(void) +nm_os_vi_init_index(void) { int i; for (i = 0; i < NM_VI_MAX; i++) @@ -404,7 +412,7 @@ * increment this refcount on if_attach(). */ int -nm_vi_persist(const char *name, struct ifnet **ret) +nm_os_vi_persist(const char *name, struct ifnet **ret) { struct ifnet *ifp; u_short macaddr_hi; @@ -444,9 +452,10 @@ *ret = ifp; return 0; } + /* unregister from the system and drop the final refcount */ void -nm_vi_detach(struct ifnet *ifp) +nm_os_vi_detach(struct ifnet *ifp) { nm_vi_free_index(((char *)IF_LLADDR(ifp))[5]); ether_ifdetach(ifp); @@ -470,8 +479,7 @@ /* * ptnetmap memdev private data structure */ -struct ptnetmap_memdev -{ +struct ptnetmap_memdev { device_t dev; struct resource *pci_io; struct resource *pci_mem; @@ -496,20 +504,23 @@ PTN_MEMDEV_NAME, ptn_memdev_methods, sizeof(struct ptnetmap_memdev), }; -devclass_t ptnetmap_devclass; +static devclass_t ptnetmap_devclass; DRIVER_MODULE(netmap, pci, ptn_memdev_driver, ptnetmap_devclass, 0, 0); MODULE_DEPEND(netmap, pci, 1, 1, 1); /* * I/O port read/write wrappers. + * Some are not used, so we keep them commented out until needed */ -#define ptn_ioread8(ptn_dev, reg) bus_read_1((ptn_dev)->pci_io, (reg)) #define ptn_ioread16(ptn_dev, reg) bus_read_2((ptn_dev)->pci_io, (reg)) #define ptn_ioread32(ptn_dev, reg) bus_read_4((ptn_dev)->pci_io, (reg)) +#if 0 +#define ptn_ioread8(ptn_dev, reg) bus_read_1((ptn_dev)->pci_io, (reg)) #define ptn_iowrite8(ptn_dev, reg, val) bus_write_1((ptn_dev)->pci_io, (reg), (val)) #define ptn_iowrite16(ptn_dev, reg, val) bus_write_2((ptn_dev)->pci_io, (reg), (val)) #define ptn_iowrite32(ptn_dev, reg, val) bus_write_4((ptn_dev)->pci_io, (reg), (val)) +#endif /* unused */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@freebsd.org Thu Aug 13 11:06:18 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E1489B80C5 for ; Thu, 13 Aug 2015 11:06:18 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EBAE27D for ; Thu, 13 Aug 2015 11:06:18 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7DB6IP2032843 for ; Thu, 13 Aug 2015 11:06:18 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7DB6I3H032840 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 11:06:18 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 11:06:18 GMT Message-Id: <201508131106.t7DB6I3H032840@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289683 - soc2015/stefano/ptnetmap/stable/10/sys/amd64/include MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 11:06:18 -0000 Author: stefano Date: Thu Aug 13 11:06:17 2015 New Revision: 289683 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289683 Log: vmm-ptnetmap: fix little refuse Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/include/vmm_dev.h Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/include/vmm_dev.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/amd64/include/vmm_dev.h Thu Aug 13 10:36:44 2015 (r289682) +++ soc2015/stefano/ptnetmap/stable/10/sys/amd64/include/vmm_dev.h Thu Aug 13 11:06:17 2015 (r289683) @@ -124,7 +124,7 @@ uint32_t data; /* data to match */ enum vm_io_regh_type type; /* handler type */ void *arg; /* handler argument */ -};a specific value that mathces +}; struct vm_pptdev_msi { int vcpu; From owner-svn-soc-all@freebsd.org Thu Aug 13 12:28:26 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 495A89A053F for ; Thu, 13 Aug 2015 12:28:26 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 399DC73 for ; Thu, 13 Aug 2015 12:28:26 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7DCSQA7007350 for ; Thu, 13 Aug 2015 12:28:26 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7DCSODP007312 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 12:28:24 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 12:28:24 GMT Message-Id: <201508131228.t7DCSODP007312@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289684 - soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 12:28:26 -0000 Author: stefano Date: Thu Aug 13 12:28:23 2015 New Revision: 289684 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289684 Log: bhyve-ptnetmap: fix compilation warning Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/bhyverun.h soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile Thu Aug 13 11:06:17 2015 (r289683) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile Thu Aug 13 12:28:23 2015 (r289684) @@ -45,6 +45,7 @@ .PATH: ${.CURDIR}/../../sys/amd64/vmm SRCS+= vmm_instruction_emul.c +CFLAGS = -I${.CURDIR}/../../sys DPADD= ${LIBVMMAPI} ${LIBMD} ${LIBUTIL} ${LIBPTHREAD} LDADD= -lvmmapi -lmd -lutil -lpthread Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/bhyverun.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/bhyverun.h Thu Aug 13 11:06:17 2015 (r289683) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/bhyverun.h Thu Aug 13 12:28:23 2015 (r289684) @@ -32,7 +32,8 @@ #ifndef CTASSERT /* Allow lint to override */ #define CTASSERT(x) _CTASSERT(x, __LINE__) #define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] +#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] \ + __unused #endif #define VMEXIT_CONTINUE 1 /* continue from next instruction */ Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c Thu Aug 13 11:06:17 2015 (r289683) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c Thu Aug 13 12:28:23 2015 (r289684) @@ -253,7 +253,6 @@ ptn_memdev_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) { struct ptn_memdev_softc *sc; - uint64_t size; int ret; sc = ptn_memdev_find_empty_pi(); Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h Thu Aug 13 11:06:17 2015 (r289683) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h Thu Aug 13 12:28:23 2015 (r289684) @@ -235,7 +235,7 @@ PTNETMAP_CFG_FEAT_IOCTL; /* Configure the net backend. */ - ret = ptnetmap_create(sc->ptn.state, &sc->ptn.cfg); + ret = ptnetmap_create(ptns, &sc->ptn.cfg); if (ret) goto err_ptn_create; @@ -261,11 +261,11 @@ static int pci_vtnet_ptnetmap_down(struct pci_vtnet_softc *sc) { + struct ptnetmap_state *ptns = sc->ptn.state; struct pci_devinst *pi; struct vmctx *vmctx; - int ret; - if (!sc->ptn.state || !sc->ptn.up) { + if (!ptns || !sc->ptn.up) { return (0); } @@ -282,7 +282,7 @@ sc->ptn.up = 0; - return (ptnetmap_delete(sc->ptn.state)); + return (ptnetmap_delete(ptns)); } /* @@ -292,9 +292,10 @@ pci_vtnet_ptnetmap_write(struct pci_vtnet_softc *sc, int offset, int size, uint32_t value) { + struct ptnetmap_state *ptns = sc->ptn.state; uint32_t *val, ret; - if (sc->ptn.state == NULL) { + if (ptns == NULL) { printf("ERROR ptnetmap: not supported by backend\n"); return -1; } @@ -306,7 +307,7 @@ case PTNETMAP_VIRTIO_IO_PTFEAT: val = (uint32_t *)(sc->ptn.reg + offset); ret = (sc->ptn.features &= *val); - ptnetmap_ack_features(sc->ptn.state, sc->ptn.features); + ptnetmap_ack_features(ptns, sc->ptn.features); sc->ptn.reg[PTNETMAP_VIRTIO_IO_PTFEAT] = ret; break; @@ -325,7 +326,7 @@ ret = pci_vtnet_ptnetmap_down(sc); break; case NET_PARAVIRT_PTCTL_HOSTMEMID: - ret = ptnetmap_get_hostmemid(sc->ptn.state); + ret = ptnetmap_get_hostmemid(ptns); break; case NET_PARAVIRT_PTCTL_IFNEW: case NET_PARAVIRT_PTCTL_IFDELETE: From owner-svn-soc-all@freebsd.org Thu Aug 13 14:30:58 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E07C9B7F36 for ; Thu, 13 Aug 2015 14:30:58 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DB6CAB6 for ; Thu, 13 Aug 2015 14:30:58 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7DEUwuK052894 for ; Thu, 13 Aug 2015 14:30:58 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7DEUvWo052833 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 14:30:57 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 14:30:57 GMT Message-Id: <201508131430.t7DEUvWo052833@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289689 - in soc2015/stefano/ptnetmap: head/sys/dev/virtio/network stable/10/sys/dev/virtio/network MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 14:30:58 -0000 Author: stefano Date: Thu Aug 13 14:30:57 2015 New Revision: 289689 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289689 Log: [ptnetmap] fix virtio-net ptnetmap patch Modified: soc2015/stefano/ptnetmap/head/sys/dev/virtio/network/if_vtnet.c soc2015/stefano/ptnetmap/stable/10/sys/dev/virtio/network/if_vtnet.c Modified: soc2015/stefano/ptnetmap/head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- soc2015/stefano/ptnetmap/head/sys/dev/virtio/network/if_vtnet.c Thu Aug 13 13:38:09 2015 (r289688) +++ soc2015/stefano/ptnetmap/head/sys/dev/virtio/network/if_vtnet.c Thu Aug 13 14:30:57 2015 (r289689) @@ -291,7 +291,7 @@ #ifdef DEV_NETMAP #include #else -#define VTNET_PTNETMAP_ON(_na) 0 +#define VTNET_PTNETMAP_ON(_na) 0 #endif /* DEV_NETMAP */ static driver_t vtnet_driver = { @@ -1859,7 +1859,8 @@ } more = vtnet_rxq_eof(rxq); - if (!VTNET_PTNETMAP_ON(NA(ifp)) && (more || vtnet_rxq_enable_intr(rxq) != 0)) { + if (!VTNET_PTNETMAP_ON(NA(ifp)) && + (more || vtnet_rxq_enable_intr(rxq) != 0)) { if (!more) vtnet_rxq_disable_intr(rxq); /* @@ -1896,7 +1897,8 @@ } more = vtnet_rxq_eof(rxq); - if (!VTNET_PTNETMAP_ON(NA(ifp)) && (more || vtnet_rxq_enable_intr(rxq) != 0)) { + if (!VTNET_PTNETMAP_ON(NA(ifp)) && + (more || vtnet_rxq_enable_intr(rxq) != 0)) { if (!more) vtnet_rxq_disable_intr(rxq); rxq->vtnrx_stats.vrxs_rescheduled++; Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/virtio/network/if_vtnet.c Thu Aug 13 13:38:09 2015 (r289688) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/virtio/network/if_vtnet.c Thu Aug 13 14:30:57 2015 (r289689) @@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -51,7 +50,6 @@ #include #include -#include #include #include #include @@ -107,7 +105,6 @@ static int vtnet_setup_interface(struct vtnet_softc *); static int vtnet_change_mtu(struct vtnet_softc *, int); static int vtnet_ioctl(struct ifnet *, u_long, caddr_t); -static uint64_t vtnet_get_counter(struct ifnet *, ift_counter); static int vtnet_rxq_populate(struct vtnet_rxq *); static void vtnet_rxq_free_mbufs(struct vtnet_rxq *); @@ -161,8 +158,11 @@ #endif static int vtnet_watchdog(struct vtnet_txq *); -static void vtnet_accum_stats(struct vtnet_softc *, - struct vtnet_rxq_stats *, struct vtnet_txq_stats *); +static void vtnet_rxq_accum_stats(struct vtnet_rxq *, + struct vtnet_rxq_stats *); +static void vtnet_txq_accum_stats(struct vtnet_txq *, + struct vtnet_txq_stats *); +static void vtnet_accumulate_stats(struct vtnet_softc *); static void vtnet_tick(void *); static void vtnet_start_taskqueues(struct vtnet_softc *); @@ -267,7 +267,7 @@ { VIRTIO_NET_F_GUEST_ANNOUNCE, "GuestAnnounce" }, { VIRTIO_NET_F_MQ, "Multiqueue" }, { VIRTIO_NET_F_CTRL_MAC_ADDR, "SetMacAddress" }, - { VIRTIO_NET_F_PTNETMAP, "PTNetmap" }, + { VIRTIO_NET_F_PTNETMAP,i "PTNetmap" }, { 0, NULL } }; @@ -291,7 +291,7 @@ #ifdef DEV_NETMAP #include #else -#define VTNET_PTNETMAP_ON(_na) 0 +#define VTNET_PTNETMAP_ON(_na) 0 #endif /* DEV_NETMAP */ static driver_t vtnet_driver = { @@ -301,8 +301,6 @@ }; static devclass_t vtnet_devclass; -DRIVER_MODULE(vtnet, virtio_mmio, vtnet_driver, vtnet_devclass, - vtnet_modevent, 0); DRIVER_MODULE(vtnet, virtio_pci, vtnet_driver, vtnet_devclass, vtnet_modevent, 0); MODULE_VERSION(vtnet, 1); @@ -921,12 +919,12 @@ } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_baudrate = IF_Gbps(10); /* Approx. */ + if_initbaudrate(ifp, IF_Gbps(10)); /* Approx. */ ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_init = vtnet_init; ifp->if_ioctl = vtnet_ioctl; - ifp->if_get_counter = vtnet_get_counter; + #ifndef VTNET_LEGACY_TX ifp->if_transmit = vtnet_txq_mq_start; ifp->if_qflush = vtnet_qflush; @@ -952,7 +950,7 @@ ifp->if_capabilities |= IFCAP_LINKSTATE; /* Tell the upper layer(s) we support long frames. */ - ifp->if_hdrlen = sizeof(struct ether_vlan_header); + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU; if (virtio_with_feature(dev, VIRTIO_NET_F_CSUM)) { @@ -1859,7 +1857,8 @@ } more = vtnet_rxq_eof(rxq); - if (!VTNET_PTNETMAP_ON(NA(ifp)) && (more || vtnet_rxq_enable_intr(rxq) != 0)) { + if (!VTNET_PTNETMAP_ON(NA(ifp)) && + (more || vtnet_rxq_enable_intr(rxq) != 0)) { if (!more) vtnet_rxq_disable_intr(rxq); /* @@ -1896,7 +1895,8 @@ } more = vtnet_rxq_eof(rxq); - if (!VTNET_PTNETMAP_ON(NA(ifp)) && (more || vtnet_rxq_enable_intr(rxq) != 0)) { + if (!VTNET_PTNETMAP_ON(NA(ifp)) && + (more || vtnet_rxq_enable_intr(rxq) != 0)) { if (!more) vtnet_rxq_disable_intr(rxq); rxq->vtnrx_stats.vrxs_rescheduled++; @@ -2578,62 +2578,74 @@ } static void -vtnet_accum_stats(struct vtnet_softc *sc, struct vtnet_rxq_stats *rxacc, - struct vtnet_txq_stats *txacc) +vtnet_rxq_accum_stats(struct vtnet_rxq *rxq, struct vtnet_rxq_stats *accum) { + struct vtnet_rxq_stats *st; - bzero(rxacc, sizeof(struct vtnet_rxq_stats)); - bzero(txacc, sizeof(struct vtnet_txq_stats)); + st = &rxq->vtnrx_stats; - for (int i = 0; i < sc->vtnet_max_vq_pairs; i++) { - struct vtnet_rxq_stats *rxst; - struct vtnet_txq_stats *txst; + accum->vrxs_ipackets += st->vrxs_ipackets; + accum->vrxs_ibytes += st->vrxs_ibytes; + accum->vrxs_iqdrops += st->vrxs_iqdrops; + accum->vrxs_csum += st->vrxs_csum; + accum->vrxs_csum_failed += st->vrxs_csum_failed; + accum->vrxs_rescheduled += st->vrxs_rescheduled; +} + +static void +vtnet_txq_accum_stats(struct vtnet_txq *txq, struct vtnet_txq_stats *accum) +{ + struct vtnet_txq_stats *st; - rxst = &sc->vtnet_rxqs[i].vtnrx_stats; - rxacc->vrxs_ipackets += rxst->vrxs_ipackets; - rxacc->vrxs_ibytes += rxst->vrxs_ibytes; - rxacc->vrxs_iqdrops += rxst->vrxs_iqdrops; - rxacc->vrxs_csum += rxst->vrxs_csum; - rxacc->vrxs_csum_failed += rxst->vrxs_csum_failed; - rxacc->vrxs_rescheduled += rxst->vrxs_rescheduled; + st = &txq->vtntx_stats; - txst = &sc->vtnet_txqs[i].vtntx_stats; - txacc->vtxs_opackets += txst->vtxs_opackets; - txacc->vtxs_obytes += txst->vtxs_obytes; - txacc->vtxs_csum += txst->vtxs_csum; - txacc->vtxs_tso += txst->vtxs_tso; - txacc->vtxs_rescheduled += txst->vtxs_rescheduled; - } + accum->vtxs_opackets += st->vtxs_opackets; + accum->vtxs_obytes += st->vtxs_obytes; + accum->vtxs_csum += st->vtxs_csum; + accum->vtxs_tso += st->vtxs_tso; + accum->vtxs_rescheduled += st->vtxs_rescheduled; } -static uint64_t -vtnet_get_counter(if_t ifp, ift_counter cnt) +static void +vtnet_accumulate_stats(struct vtnet_softc *sc) { - struct vtnet_softc *sc; + struct ifnet *ifp; + struct vtnet_statistics *st; struct vtnet_rxq_stats rxaccum; struct vtnet_txq_stats txaccum; + int i; + + ifp = sc->vtnet_ifp; + st = &sc->vtnet_stats; + bzero(&rxaccum, sizeof(struct vtnet_rxq_stats)); + bzero(&txaccum, sizeof(struct vtnet_txq_stats)); - sc = if_getsoftc(ifp); - vtnet_accum_stats(sc, &rxaccum, &txaccum); + for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { + vtnet_rxq_accum_stats(&sc->vtnet_rxqs[i], &rxaccum); + vtnet_txq_accum_stats(&sc->vtnet_txqs[i], &txaccum); + } - switch (cnt) { - case IFCOUNTER_IPACKETS: - return (rxaccum.vrxs_ipackets); - case IFCOUNTER_IQDROPS: - return (rxaccum.vrxs_iqdrops); - case IFCOUNTER_IERRORS: - return (rxaccum.vrxs_ierrors); - case IFCOUNTER_OPACKETS: - return (txaccum.vtxs_opackets); + st->rx_csum_offloaded = rxaccum.vrxs_csum; + st->rx_csum_failed = rxaccum.vrxs_csum_failed; + st->rx_task_rescheduled = rxaccum.vrxs_rescheduled; + st->tx_csum_offloaded = txaccum.vtxs_csum; + st->tx_tso_offloaded = txaccum.vtxs_tso; + st->tx_task_rescheduled = txaccum.vtxs_rescheduled; + + /* + * With the exception of if_ierrors, these ifnet statistics are + * only updated in the driver, so just set them to our accumulated + * values. if_ierrors is updated in ether_input() for malformed + * frames that we should have already discarded. + */ + ifp->if_ipackets = rxaccum.vrxs_ipackets; + ifp->if_iqdrops = rxaccum.vrxs_iqdrops; + ifp->if_ierrors = rxaccum.vrxs_ierrors; + ifp->if_opackets = txaccum.vtxs_opackets; #ifndef VTNET_LEGACY_TX - case IFCOUNTER_OBYTES: - return (txaccum.vtxs_obytes); - case IFCOUNTER_OMCASTS: - return (txaccum.vtxs_omcasts); + ifp->if_obytes = txaccum.vtxs_obytes; + ifp->if_omcasts = txaccum.vtxs_omcasts; #endif - default: - return (if_get_counter_default(ifp, cnt)); - } } static void @@ -2648,6 +2660,7 @@ timedout = 0; VTNET_CORE_LOCK_ASSERT(sc); + vtnet_accumulate_stats(sc); for (i = 0; i < sc->vtnet_act_vq_pairs; i++) timedout |= vtnet_watchdog(&sc->vtnet_txqs[i]); @@ -3759,18 +3772,8 @@ struct sysctl_oid_list *child, struct vtnet_softc *sc) { struct vtnet_statistics *stats; - struct vtnet_rxq_stats rxaccum; - struct vtnet_txq_stats txaccum; - - vtnet_accum_stats(sc, &rxaccum, &txaccum); stats = &sc->vtnet_stats; - stats->rx_csum_offloaded = rxaccum.vrxs_csum; - stats->rx_csum_failed = rxaccum.vrxs_csum_failed; - stats->rx_task_rescheduled = rxaccum.vrxs_rescheduled; - stats->tx_csum_offloaded = txaccum.vtxs_csum; - stats->tx_tso_offloaded = txaccum.vtxs_tso; - stats->tx_task_rescheduled = txaccum.vtxs_rescheduled; SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "mbuf_alloc_failed", CTLFLAG_RD, &stats->mbuf_alloc_failed, From owner-svn-soc-all@freebsd.org Thu Aug 13 14:47:24 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56D709A0319 for ; Thu, 13 Aug 2015 14:47:24 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4770B666 for ; Thu, 13 Aug 2015 14:47:24 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7DElOft078236 for ; Thu, 13 Aug 2015 14:47:24 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7DElNmM078227 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 14:47:23 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 14:47:23 GMT Message-Id: <201508131447.t7DElNmM078227@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289690 - in soc2015/stefano/ptnetmap/stable/10/sys: amd64/vmm dev/virtio/network MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 14:47:24 -0000 Author: stefano Date: Thu Aug 13 14:47:22 2015 New Revision: 289690 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289690 Log: vmm-ptnetmap: fix little refuse Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.c soc2015/stefano/ptnetmap/stable/10/sys/dev/virtio/network/if_vtnet.c Modified: soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.c Thu Aug 13 14:30:57 2015 (r289689) +++ soc2015/stefano/ptnetmap/stable/10/sys/amd64/vmm/vmm_ioport.c Thu Aug 13 14:47:22 2015 (r289690) @@ -128,7 +128,7 @@ struct ioport_reg_handler *regh, uint32_t *val); struct ioport_reg_handler { - uint16_t port;i /* I/O address */ + uint16_t port; /* I/O address */ uint16_t in; /* 0 out, 1 in */ uint32_t mask_data; /* 0 means match anything */ uint32_t data; /* data to match */ Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/virtio/network/if_vtnet.c Thu Aug 13 14:30:57 2015 (r289689) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/virtio/network/if_vtnet.c Thu Aug 13 14:47:22 2015 (r289690) @@ -267,7 +267,7 @@ { VIRTIO_NET_F_GUEST_ANNOUNCE, "GuestAnnounce" }, { VIRTIO_NET_F_MQ, "Multiqueue" }, { VIRTIO_NET_F_CTRL_MAC_ADDR, "SetMacAddress" }, - { VIRTIO_NET_F_PTNETMAP,i "PTNetmap" }, + { VIRTIO_NET_F_PTNETMAP, "PTNetmap" }, { 0, NULL } }; From owner-svn-soc-all@freebsd.org Thu Aug 13 14:52:15 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 793479A04A5 for ; Thu, 13 Aug 2015 14:52:15 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A0B1BC7 for ; Thu, 13 Aug 2015 14:52:15 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7DEqFqq089128 for ; Thu, 13 Aug 2015 14:52:15 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7DEqE36089109 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 14:52:14 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 14:52:14 GMT Message-Id: <201508131452.t7DEqE36089109@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289691 - soc2015/stefano/ptnetmap/stable/10/sys/dev/cxgbe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 14:52:15 -0000 Author: stefano Date: Thu Aug 13 14:52:14 2015 New Revision: 289691 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289691 Log: cxgbe: remove netmap *sync_finalize/prologue() Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/cxgbe/t4_netmap.c Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/cxgbe/t4_netmap.c Thu Aug 13 14:47:22 2015 (r289690) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/cxgbe/t4_netmap.c Thu Aug 13 14:52:14 2015 (r289691) @@ -908,8 +908,6 @@ kring->nr_hwtail -= kring->nkr_num_slots; } - nm_txsync_finalize(kring); - return (0); } @@ -922,7 +920,7 @@ struct port_info *pi = ifp->if_softc; struct adapter *sc = pi->adapter; struct sge_nm_rxq *nm_rxq = &sc->sge.nm_rxq[pi->first_nm_rxq + kring->ring_id]; - u_int const head = nm_rxsync_prologue(kring); + u_int const head = kring->rhead; u_int n; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; @@ -984,8 +982,6 @@ } } - nm_rxsync_finalize(kring); - return (0); } From owner-svn-soc-all@freebsd.org Thu Aug 13 14:59:39 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6A189A0536 for ; Thu, 13 Aug 2015 14:59:39 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFDFDDC8 for ; Thu, 13 Aug 2015 14:59:39 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7DExd6v096593 for ; Thu, 13 Aug 2015 14:59:39 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7DExdDf096588 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 14:59:39 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 14:59:39 GMT Message-Id: <201508131459.t7DExdDf096588@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289692 - soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 14:59:40 -0000 Author: stefano Date: Thu Aug 13 14:59:38 2015 New Revision: 289692 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289692 Log: ptnetmap-if_lem: remove warning Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_lem_netmap.h Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_lem_netmap.h Thu Aug 13 14:52:14 2015 (r289691) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/if_lem_netmap.h Thu Aug 13 14:59:38 2015 (r289692) @@ -645,12 +645,14 @@ static struct netmap_pt_guest_ops lem_ptnetmap_ops = { .nm_ptctl = lem_ptnetmap_ptctl, }; +/* XXX: these warning affect the proper kernel compilation #elif defined (NIC_PTNETMAP) #warning "if_lem supports ptnetmap but netmap does not support it" #warning "(configure netmap with ptnetmap support)" #elif defined (WITH_PTNETMAP_GUEST) #warning "netmap supports ptnetmap but e1000 does not support it" #warning "(configure if_lem with ptnetmap support)" +*/ #endif /* NIC_PTNETMAP && WITH_PTNETMAP_GUEST */ static void From owner-svn-soc-all@freebsd.org Thu Aug 13 15:37:06 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D3489A0CEA for ; Thu, 13 Aug 2015 15:37:06 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 382E39DF for ; Thu, 13 Aug 2015 15:37:06 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7DFb6BE007054 for ; Thu, 13 Aug 2015 15:37:06 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7DFb3pp006968 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 15:37:03 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 15:37:03 GMT Message-Id: <201508131537.t7DFb3pp006968@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289697 - in soc2015/stefano/ptnetmap/stable/10: sys/dev/netmap usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 15:37:06 -0000 Author: stefano Date: Thu Aug 13 15:37:03 2015 New Revision: 289697 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289697 Log: ptnetmap: fix PTNETMAP_IO_SIZE macro Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_mem2.c soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_virt.h soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_net.c soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_mem2.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_mem2.c Thu Aug 13 14:53:29 2015 (r289696) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_mem2.c Thu Aug 13 15:37:03 2015 (r289697) @@ -1997,7 +1997,7 @@ error = ENOMEM; goto err; } - /* map memory through ptnemtap-memdev BAR */ + /* map memory through ptnetmap-memdev BAR */ error = nm_os_pt_memdev_iomap(pv->ptn_dev, &pv->nm_paddr, &pv->nm_addr); if (error) goto err; Modified: soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_virt.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_virt.h Thu Aug 13 14:53:29 2015 (r289696) +++ soc2015/stefano/ptnetmap/stable/10/sys/dev/netmap/netmap_virt.h Thu Aug 13 15:37:03 2015 (r289697) @@ -211,8 +211,8 @@ /* 32 bit w/o */ #define PTNETMAP_VIRTIO_IO_CSBBAL 16 /* CSB Base Address Low */ -#define PTNEMTAP_VIRTIO_IO_SIZE 20 -#define PTNEMTAP_VIRTIO_IO_SIZE_32 5 +#define PTNETMAP_VIRTIO_IO_SIZE 20 +#define PTNETMAP_VIRTIO_IO_SIZE_32 5 #endif /* NETMAP_VIRT_CSB */ @@ -242,7 +242,7 @@ */ /* 16 bit r/o */ #define PTNETMAP_IO_PCI_HOSTID 8 /* memory allocator ID in netmap host */ -#define PTNEMTAP_IO_SIZE 10 +#define PTNETMAP_IO_SIZE 10 /* * ptnetmap configuration Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile Thu Aug 13 14:53:29 2015 (r289696) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile Thu Aug 13 15:37:03 2015 (r289697) @@ -4,7 +4,7 @@ PROG= bhyve -DEBUG_FLAGS= -g -O0 +DEBUG_FLAGS= -g -O0 MAN= bhyve.8 @@ -45,7 +45,14 @@ .PATH: ${.CURDIR}/../../sys/amd64/vmm SRCS+= vmm_instruction_emul.c -CFLAGS = -I${.CURDIR}/../../sys +.ifdef CROSS_BUILD +BASEDIR=/home/stefano/repos +S=${BASEDIR}/freebsd +M=${BASEDIR}/obj_head${S}/tmp/usr +.PATH: ${S}/sys/amd64/vmm +CFLAGS = -I${BASEDIR}/netmap/sys -I${M}/include -I/${S}/sys -L${M}/lib +.endif + DPADD= ${LIBVMMAPI} ${LIBMD} ${LIBUTIL} ${LIBPTHREAD} LDADD= -lvmmapi -lmd -lutil -lpthread Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c Thu Aug 13 14:53:29 2015 (r289696) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_ptnetmap_memdev.c Thu Aug 13 15:37:03 2015 (r289697) @@ -220,7 +220,7 @@ /* alloc IO-BAR */ ret = pci_emul_alloc_bar(sc->pi, PTNETMAP_IO_PCI_BAR, PCIBAR_IO, - PTNEMTAP_IO_SIZE); + PTNETMAP_IO_SIZE); if (ret) { printf("ptnetmap_memdev: iobar allocation error %d\n", ret); return ret; Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_net.c Thu Aug 13 14:53:29 2015 (r289696) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_net.c Thu Aug 13 15:37:03 2015 (r289697) @@ -141,7 +141,7 @@ struct ptnetmap_cfg cfg; /* ptnetmap configuration */ /* ptnetmap register */ - uint8_t reg[PTNEMTAP_VIRTIO_IO_SIZE]; + uint8_t reg[PTNETMAP_VIRTIO_IO_SIZE]; }; #endif /* Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h Thu Aug 13 14:53:29 2015 (r289696) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/pci_virtio_ptnetmap.h Thu Aug 13 15:37:03 2015 (r289697) @@ -107,7 +107,7 @@ } /* extend cfgsize. virtio creates PCIBAR for us */ - vc->vc_cfgsize += PTNEMTAP_VIRTIO_IO_SIZE; + vc->vc_cfgsize += PTNETMAP_VIRTIO_IO_SIZE; } /* From owner-svn-soc-all@freebsd.org Thu Aug 13 15:40:45 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22C729A0DD5 for ; Thu, 13 Aug 2015 15:40:45 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13C49D12 for ; Thu, 13 Aug 2015 15:40:45 +0000 (UTC) (envelope-from stefano@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7DFei7b012944 for ; Thu, 13 Aug 2015 15:40:44 GMT (envelope-from stefano@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7DFeiJH012926 for svn-soc-all@FreeBSD.org; Thu, 13 Aug 2015 15:40:44 GMT (envelope-from stefano@FreeBSD.org) Date: Thu, 13 Aug 2015 15:40:44 GMT Message-Id: <201508131540.t7DFeiJH012926@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to stefano@FreeBSD.org using -f From: stefano@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289698 - soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 15:40:45 -0000 Author: stefano Date: Thu Aug 13 15:40:43 2015 New Revision: 289698 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289698 Log: bhyve: restore original Makefile Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile Modified: soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile Thu Aug 13 15:37:03 2015 (r289697) +++ soc2015/stefano/ptnetmap/stable/10/usr.sbin/bhyve/Makefile Thu Aug 13 15:40:43 2015 (r289698) @@ -4,7 +4,7 @@ PROG= bhyve -DEBUG_FLAGS= -g -O0 +DEBUG_FLAGS= -g -O0 MAN= bhyve.8 @@ -45,14 +45,7 @@ .PATH: ${.CURDIR}/../../sys/amd64/vmm SRCS+= vmm_instruction_emul.c -.ifdef CROSS_BUILD -BASEDIR=/home/stefano/repos -S=${BASEDIR}/freebsd -M=${BASEDIR}/obj_head${S}/tmp/usr -.PATH: ${S}/sys/amd64/vmm -CFLAGS = -I${BASEDIR}/netmap/sys -I${M}/include -I/${S}/sys -L${M}/lib -.endif - +CFLAGS = -I${.CURDIR}/../../sys DPADD= ${LIBVMMAPI} ${LIBMD} ${LIBUTIL} ${LIBPTHREAD} LDADD= -lvmmapi -lmd -lutil -lpthread From owner-svn-soc-all@freebsd.org Fri Aug 14 02:04:04 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A03B99F77B for ; Fri, 14 Aug 2015 02:04:04 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1ACD31CF0 for ; Fri, 14 Aug 2015 02:04:04 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7E243jD024771 for ; Fri, 14 Aug 2015 02:04:03 GMT (envelope-from clord@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7E243He024754 for svn-soc-all@FreeBSD.org; Fri, 14 Aug 2015 02:04:03 GMT (envelope-from clord@FreeBSD.org) Date: Fri, 14 Aug 2015 02:04:03 GMT Message-Id: <201508140204.t7E243He024754@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to clord@FreeBSD.org using -f From: clord@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289730 - soc2015/clord/head/sys/boot/ficl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2015 02:04:04 -0000 Author: clord Date: Fri Aug 14 02:04:03 2015 New Revision: 289730 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289730 Log: Add math library and reorder ficl softwords so that functions get defined before they are needed. Modified: soc2015/clord/head/sys/boot/ficl/Makefile Modified: soc2015/clord/head/sys/boot/ficl/Makefile ============================================================================== --- soc2015/clord/head/sys/boot/ficl/Makefile Fri Aug 14 01:27:30 2015 (r289729) +++ soc2015/clord/head/sys/boot/ficl/Makefile Fri Aug 14 02:04:03 2015 (r289730) @@ -16,8 +16,9 @@ stack.c system.c tools.c unix.c utility.c vm.c word.c SRCS= ${BASE_SRCS} sysdep.c softcore.c -CLEANFILES= softcore.c main main.o +CLEANFILES= softcore.c main main.o extras.o CFLAGS+= -ffreestanding +LDADD+= -lm .if ${MACHINE_CPUARCH} == "i386" || \ (${MACHINE_CPUARCH} == "amd64" && defined(FICL32)) CFLAGS+= -march=i386 @@ -54,8 +55,8 @@ # Standard softwords .PATH: ${FICLDIR}/softcore -SOFTWORDS= softcore.fr jhlocal.fr marker.fr freebsd.fr ficllocal.fr \ - ifbrack.fr +SOFTWORDS= softcore.fr ifbrack.fr ficl.fr jhlocal.fr marker.fr \ + freebsd.fr ficllocal.fr # Optional OO extension softwords #SOFTWORDS+= oo.fr classes.fr From owner-svn-soc-all@freebsd.org Fri Aug 14 02:05:41 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DE9D99F793 for ; Fri, 14 Aug 2015 02:05:41 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2B9E1D16 for ; Fri, 14 Aug 2015 02:05:40 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7E25eHr026734 for ; Fri, 14 Aug 2015 02:05:40 GMT (envelope-from clord@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7E25ede026729 for svn-soc-all@FreeBSD.org; Fri, 14 Aug 2015 02:05:40 GMT (envelope-from clord@FreeBSD.org) Date: Fri, 14 Aug 2015 02:05:40 GMT Message-Id: <201508140205.t7E25ede026729@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to clord@FreeBSD.org using -f From: clord@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289731 - soc2015/clord/head/sys/boot/i386/loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2015 02:05:41 -0000 Author: clord Date: Fri Aug 14 02:05:39 2015 New Revision: 289731 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289731 Log: Add math library to linker flags. Modified: soc2015/clord/head/sys/boot/i386/loader/Makefile Modified: soc2015/clord/head/sys/boot/i386/loader/Makefile ============================================================================== --- soc2015/clord/head/sys/boot/i386/loader/Makefile Fri Aug 14 02:04:03 2015 (r289730) +++ soc2015/clord/head/sys/boot/i386/loader/Makefile Fri Aug 14 02:05:39 2015 (r289731) @@ -122,7 +122,7 @@ OBJS= ${BTXCRT} DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} +LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} -lm .include From owner-svn-soc-all@freebsd.org Fri Aug 14 02:07:54 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54E5E99F7C8 for ; Fri, 14 Aug 2015 02:07:54 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45C251D88 for ; Fri, 14 Aug 2015 02:07:54 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7E27sn3029147 for ; Fri, 14 Aug 2015 02:07:54 GMT (envelope-from clord@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7E27rw7029136 for svn-soc-all@FreeBSD.org; Fri, 14 Aug 2015 02:07:53 GMT (envelope-from clord@FreeBSD.org) Date: Fri, 14 Aug 2015 02:07:53 GMT Message-Id: <201508140207.t7E27rw7029136@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to clord@FreeBSD.org using -f From: clord@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289732 - soc2015/clord/head/sys/contrib/ficl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2015 02:07:54 -0000 Author: clord Date: Fri Aug 14 02:07:53 2015 New Revision: 289732 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289732 Log: Include a test for TESTMAIN around pcibios functions. Modified: soc2015/clord/head/sys/contrib/ficl/loader.c Modified: soc2015/clord/head/sys/contrib/ficl/loader.c ============================================================================== --- soc2015/clord/head/sys/contrib/ficl/loader.c Fri Aug 14 02:05:39 2015 (r289731) +++ soc2015/clord/head/sys/contrib/ficl/loader.c Fri Aug 14 02:07:53 2015 (r289732) @@ -729,6 +729,7 @@ } +#ifndef TESTMAIN #ifdef __i386__ /* * pcibios-device-count (devid -- count) @@ -863,6 +864,7 @@ stackPushINT(pVM->pStack, locator); } #endif +#endif /* TESTMAIN */ /* ** Retrieves free space remaining on the dictionary @@ -931,6 +933,7 @@ dictAppendWord(dp, "pnphandlers",ficlPnphandlers, FW_DEFAULT); #endif #endif +#ifndef TESTMAIN #ifdef __i386__ dictAppendWord(dp, "pcibios-device-count", ficlPciBiosCountDevices, FW_DEFAULT); dictAppendWord(dp, "pcibios-read-config", ficlPciBiosReadConfig, FW_DEFAULT); @@ -939,6 +942,7 @@ dictAppendWord(dp, "pcibios-find-device", ficlPciBiosFindDevice, FW_DEFAULT); dictAppendWord(dp, "pcibios-locator", ficlPciBiosLocator, FW_DEFAULT); #endif +#endif #if defined(PC98) ficlSetEnv(pSys, "arch-pc98", FICL_TRUE); From owner-svn-soc-all@freebsd.org Fri Aug 14 02:14:39 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0080599F99D for ; Fri, 14 Aug 2015 02:14:39 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E55AF1027 for ; Fri, 14 Aug 2015 02:14:38 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7E2EcjV022593 for ; Fri, 14 Aug 2015 02:14:38 GMT (envelope-from clord@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7E2EcSc022325 for svn-soc-all@FreeBSD.org; Fri, 14 Aug 2015 02:14:38 GMT (envelope-from clord@FreeBSD.org) Date: Fri, 14 Aug 2015 02:14:38 GMT Message-Id: <201508140214.t7E2EcSc022325@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to clord@FreeBSD.org using -f From: clord@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289733 - soc2015/clord/head/sys/contrib/ficl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2015 02:14:39 -0000 Author: clord Date: Fri Aug 14 02:14:37 2015 New Revision: 289733 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289733 Log: Modify headers to only use standard library for TESTMAIN target, otherwise use libstand. Modified: soc2015/clord/head/sys/contrib/ficl/float.c Modified: soc2015/clord/head/sys/contrib/ficl/float.c ============================================================================== --- soc2015/clord/head/sys/contrib/ficl/float.c Fri Aug 14 02:07:53 2015 (r289732) +++ soc2015/clord/head/sys/contrib/ficl/float.c Fri Aug 14 02:14:37 2015 (r289733) @@ -43,10 +43,14 @@ /* $FreeBSD$ */ +#ifdef TESTMAIN #include #include -#include #include +#else +#include +#endif +#include #include #include "ficl.h" From owner-svn-soc-all@freebsd.org Fri Aug 14 02:20:38 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D743F99FB2E for ; Fri, 14 Aug 2015 02:20:38 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7A6211A2 for ; Fri, 14 Aug 2015 02:20:38 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7E2KcGb033635 for ; Fri, 14 Aug 2015 02:20:38 GMT (envelope-from clord@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7E2KcAH033363 for svn-soc-all@FreeBSD.org; Fri, 14 Aug 2015 02:20:38 GMT (envelope-from clord@FreeBSD.org) Date: Fri, 14 Aug 2015 02:20:38 GMT Message-Id: <201508140220.t7E2KcAH033363@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to clord@FreeBSD.org using -f From: clord@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289734 - soc2015/clord/head/sys/contrib/ficl/softcore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2015 02:20:38 -0000 Author: clord Date: Fri Aug 14 02:20:37 2015 New Revision: 289734 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289734 Log: Update ficlSystemCompileSoftCore to use the newer Ficl 4 constructs. The behaviour has remained the same though. Modified: soc2015/clord/head/sys/contrib/ficl/softcore/softcore.awk Modified: soc2015/clord/head/sys/contrib/ficl/softcore/softcore.awk ============================================================================== --- soc2015/clord/head/sys/contrib/ficl/softcore/softcore.awk Fri Aug 14 02:14:37 2015 (r289733) +++ soc2015/clord/head/sys/contrib/ficl/softcore/softcore.awk Fri Aug 14 02:20:37 2015 (r289734) @@ -167,17 +167,19 @@ if (commenting) end_comments(); printf "#endif /* WANT_SOFTWORDS */\n"; printf " \"quit \";\n"; - printf "\n\nvoid ficlSystemCompileSoftCore(ficlSystem *pSys)\n"; + printf "\n\nvoid ficlSystemCompileSoftCore(ficlSystem *system)\n"; printf "{\n"; - printf " ficlVm *pVM = pSys->vmList;\n"; - printf " CELL id = pVM->sourceId;\n"; + printf " ficlVm *vm = system->vmList;\n"; + printf " int returnValue;\n"; + printf " ficlCell oldSourceID = vm->sourceId;\n"; + printf " ficlString s;\n"; printf " int ret = sizeof (softWords);\n"; - printf " assert(pVM);\n"; - printf " pVM->sourceId.i = -1;\n"; - printf " ret = ficlExec(pVM, softWords);\n"; - printf " pVM->sourceId = id;\n"; - printf " if (ret == VM_ERREXIT)\n"; - printf " assert(FALSE);\n"; + printf " vm->sourceId.i = -1;\n"; + printf " FICL_STRING_SET_POINTER(s, (char *)(softWords));\n"; + printf " FICL_STRING_SET_LENGTH(s, ret);\n"; + printf " returnValue = ficlVmExecuteString(vm, s);\n"; + printf " vm->sourceId = oldSourceID;\n"; + printf " FICL_VM_ASSERT(vm, returnValue != FICL_VM_STATUS_ERROR_EXIT);\n"; printf " return;\n"; printf "}\n"; } From owner-svn-soc-all@freebsd.org Fri Aug 14 02:25:02 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 111FE99FB60 for ; Fri, 14 Aug 2015 02:25:02 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01B7512BD for ; Fri, 14 Aug 2015 02:25:02 +0000 (UTC) (envelope-from clord@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7E2P1tQ016919 for ; Fri, 14 Aug 2015 02:25:01 GMT (envelope-from clord@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7E2P1Wg016548 for svn-soc-all@FreeBSD.org; Fri, 14 Aug 2015 02:25:01 GMT (envelope-from clord@FreeBSD.org) Date: Fri, 14 Aug 2015 02:25:01 GMT Message-Id: <201508140225.t7E2P1Wg016548@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to clord@FreeBSD.org using -f From: clord@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289735 - in soc2015/clord/head/sys/contrib/ficl: i386 softcore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2015 02:25:02 -0000 Author: clord Date: Fri Aug 14 02:25:00 2015 New Revision: 289735 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289735 Log: Since ficlInstructionF0 is only defined if FICL_WANT_FLOAT is set, modify jhlocal.fr to reflect that requirement. Set FICL_WANT_FLOAT to 1 by default. Modified: soc2015/clord/head/sys/contrib/ficl/i386/sysdep.h soc2015/clord/head/sys/contrib/ficl/softcore/jhlocal.fr Modified: soc2015/clord/head/sys/contrib/ficl/i386/sysdep.h ============================================================================== --- soc2015/clord/head/sys/contrib/ficl/i386/sysdep.h Fri Aug 14 02:20:37 2015 (r289734) +++ soc2015/clord/head/sys/contrib/ficl/i386/sysdep.h Fri Aug 14 02:25:00 2015 (r289735) @@ -183,7 +183,7 @@ ** Contributed by Guy Carver */ #if !defined (FICL_WANT_FLOAT) -#define FICL_WANT_FLOAT 0 +#define FICL_WANT_FLOAT 1 #endif /* Modified: soc2015/clord/head/sys/contrib/ficl/softcore/jhlocal.fr ============================================================================== --- soc2015/clord/head/sys/contrib/ficl/softcore/jhlocal.fr Fri Aug 14 02:20:37 2015 (r289734) +++ soc2015/clord/head/sys/contrib/ficl/softcore/jhlocal.fr Fri Aug 14 02:25:00 2015 (r289735) @@ -23,8 +23,10 @@ \ "ficlInstruction0" is the FICL instruction for "push a 0 on the data stack". \ --lch : compiled-zero ficlInstruction0 , ; +S" FICL_WANT_FLOAT" ENVIRONMENT? drop [if] \ And this is the instruction for a floating-point 0 (0.0e). : compiled-float-zero ficlInstructionF0 , ; +[endif] : ?-- ( c-addr u -- c-addr u flag ) From owner-svn-soc-all@freebsd.org Sat Aug 15 05:11:49 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EED849BA989 for ; Sat, 15 Aug 2015 05:11:49 +0000 (UTC) (envelope-from pratiksinghal@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D87FC1151 for ; Sat, 15 Aug 2015 05:11:49 +0000 (UTC) (envelope-from pratiksinghal@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7F5BnZ9034958 for ; Sat, 15 Aug 2015 05:11:49 GMT (envelope-from pratiksinghal@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7F5Bmrh034951 for svn-soc-all@FreeBSD.org; Sat, 15 Aug 2015 05:11:48 GMT (envelope-from pratiksinghal@FreeBSD.org) Date: Sat, 15 Aug 2015 05:11:48 GMT Message-Id: <201508150511.t7F5Bmrh034951@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to pratiksinghal@FreeBSD.org using -f From: pratiksinghal@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289774 - soc2015/pratiksinghal/cubie-head/sys/arm/allwinner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Aug 2015 05:11:50 -0000 Author: pratiksinghal Date: Sat Aug 15 05:11:48 2015 New Revision: 289774 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289774 Log: Corrected the initialization of AC_CTL Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.c soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.h Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.c ============================================================================== --- soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.c Sat Aug 15 00:42:33 2015 (r289773) +++ soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.c Sat Aug 15 05:11:48 2015 (r289774) @@ -155,6 +155,8 @@ sc->ienab = AC_CODEC_READY_INT_EN; AC97_WRITE(sc, AC_INT, 0); AC97_WRITE(sc, AC_INT, sc->ienab); + val = AC_TX_EN | AC_RX_EN | AC_LINK_EN | AC_GLOBAL_EN; + AC97_WRITE(sc, AC_CTL, val); return (0); Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.h ============================================================================== --- soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.h Sat Aug 15 00:42:33 2015 (r289773) +++ soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_ac97.h Sat Aug 15 05:11:48 2015 (r289774) @@ -49,9 +49,6 @@ #define AC_RX_CNT 0x2C /* AC97 RX counter register */ /* AC_CTL */ -#define AC_CODEC_FULL (1U << 18) -#define AC_CMD_FULL (1U << 17) -#define AC_RX_MIC_IN (1U << 16) #define AC_RX_MODE_MIC (1U << 9) #define AC_TX_EN (1U << 7) #define AC_RX_EN (1U << 6)