From patchwork Tue May 4 13:04:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 96760 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o44D5HSQ004302 for ; Tue, 4 May 2010 13:05:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932148Ab0EDNEo (ORCPT ); Tue, 4 May 2010 09:04:44 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:57670 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932077Ab0EDNEm (ORCPT ); Tue, 4 May 2010 09:04:42 -0400 Received: by pwi5 with SMTP id 5so147502pwi.19 for ; Tue, 04 May 2010 06:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=+DPLui1uq4ZqTyGz+bCkLgq7+FyjF1mwxzN+MGHrM3w=; b=hZMLGJK5wsfeZh7Ck0pzLr7whID34aeahA9l58Y6JeFn51JA2QPd3PDX8eBl7qZ7l/ GbL5j6yutpYpksQo74ukn6XOyevvvfxlaqvMFfukSwk60aAa8IEu5EgmNJFT47MfG234 jKbb84XTgzoH2tsmWkZi61M/GBsq4z0r5QVDA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=RrKBMK4Q5Kcx21mtvvlYq8CQ09Nk5EMMAyB4JwH9OPRGYlXfpZu0JNdh0YWLvzMVE0 0O14uvpHPERpVUkEb3CK2VSiNqdxsT6XgRrbmzf0AJygqBIEDDrXKnweU02tYSOK1fYY 6xrCusUdYBgvN+OUNzemMU99zC6xMMYhakOP0= Received: by 10.140.58.5 with SMTP id g5mr4344104rva.157.1272978260374; Tue, 04 May 2010 06:04:20 -0700 (PDT) Received: from stein (v079161.dynamic.ppp.asahi-net.or.jp [124.155.79.161]) by mx.google.com with ESMTPS id b10sm1914426rvn.3.2010.05.04.06.04.17 (version=SSLv3 cipher=RC4-MD5); Tue, 04 May 2010 06:04:19 -0700 (PDT) Date: Tue, 4 May 2010 22:04:18 +0900 From: Takuya Yoshikawa To: Takuya Yoshikawa Cc: avi@redhat.com, mtosatti@redhat.com, agraf@suse.de, yoshikawa.takuya@oss.ntt.co.jp, fernando@oss.ntt.co.jp, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-ia64@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, benh@kernel.crashing.org, paulus@samba.org, linuxppc-dev@ozlabs.org, arnd@arndb.de, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC][PATCH 7/12 not tested yet] PPC: introduce __set_bit() like function for bitmaps in user space Message-Id: <20100504220418.083929bc.takuya.yoshikawa@gmail.com> In-Reply-To: <20100504215645.6448af8f.takuya.yoshikawa@gmail.com> References: <20100504215645.6448af8f.takuya.yoshikawa@gmail.com> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.0; i486-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 04 May 2010 13:05:17 +0000 (UTC) diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index 3a01ce8..f878326 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -321,6 +321,25 @@ do { \ __gu_err; \ }) +static inline int set_bit_user_non_atomic(int nr, void __user *addr) +{ + u8 __user *p; + u8 val; + + p = (u8 __user *)((unsigned long)addr + nr / BITS_PER_BYTE); + if (!access_ok(VERIFY_WRITE, p, 1)) + return -EFAULT; + + if (__get_user(val, p)) + return -EFAULT; + + val |= 1U << (nr % BITS_PER_BYTE); + if (__put_user(val, p)) + return -EFAULT; + + return 0; +} + /* more complex routines */