Displaying 20 results from an estimated 134 matches for "do_div".
2014 Oct 02
0
[PATCH] drm/nouveau: gk20a: Fix type of dividend in do_div()
From: Thierry Reding <treding at nvidia.com>
The semantics of do_div() are (see include/asm-generic/div64.h):
uint32_t do_div(uint64_t *n, uint32_t base)
Using a different type will therefore cause the following warning (as
seen on xtensa/allmodconfig):
CC [M] drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.o
In file included from arch/xtensa/include/genera...
2019 May 23
2
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
...ouveau/nouveau_bo.c
index 34a998012bf6..cdacfe1f732c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -143,14 +143,6 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
kfree(nvbo);
}
-static inline u64
-roundup_64(u64 x, u32 y)
-{
- x += y - 1;
- do_div(x, y);
- return x * y;
-}
-
static void
nouveau_bo_fixup_align(struct nouveau_bo *nvbo, u32 flags,
int *align, u64 *size)
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index edbd5a210df2..13de9d49bd52 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -207,13 +207,6 @@ s...
2008 Aug 06
3
[PATCH RFC] do_settime is backwards?!
While digging through the time code, I found something very strange
in do_settime:
x = (secs * 1000000000ULL) + (u64)nsecs - system_time_base;
y = do_div(x, 1000000000);
spin_lock(&wc_lock);
wc_sec = _wc_sec = (u32)x;
wc_nsec = _wc_nsec = (u32)y;
spin_unlock(&wc_lock);
The value "x" appears to be the number of nanoseconds, while
the value "y" is the value in seconds. The assignments to
wc_sec and wc_...
2016 Oct 20
0
[PATCH] x86/vmware: Read tsc_khz only once - at boot time
...{
uint32_t eax, ebx, ecx, edx;
@@ -57,35 +59,32 @@ static inline int __vmware_platform(void)
static unsigned long vmware_get_tsc_khz(void)
{
- uint64_t tsc_hz, lpj;
- uint32_t eax, ebx, ecx, edx;
-
- VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
-
- tsc_hz = eax | (((uint64_t)ebx) << 32);
- do_div(tsc_hz, 1000);
- BUG_ON(tsc_hz >> 32);
- pr_info("TSC freq read from hypervisor : %lu.%03lu MHz\n",
- (unsigned long) tsc_hz / 1000,
- (unsigned long) tsc_hz % 1000);
-
- if (!preset_lpj) {
- lpj = ((u64)tsc_hz * 1000);
- do_div(lpj, HZ);
- preset_lpj = lpj;
- }
-
- return...
2016 Oct 20
0
[PATCH] x86/vmware: Read tsc_khz only once - at boot time
...{
uint32_t eax, ebx, ecx, edx;
@@ -57,35 +59,32 @@ static inline int __vmware_platform(void)
static unsigned long vmware_get_tsc_khz(void)
{
- uint64_t tsc_hz, lpj;
- uint32_t eax, ebx, ecx, edx;
-
- VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
-
- tsc_hz = eax | (((uint64_t)ebx) << 32);
- do_div(tsc_hz, 1000);
- BUG_ON(tsc_hz >> 32);
- pr_info("TSC freq read from hypervisor : %lu.%03lu MHz\n",
- (unsigned long) tsc_hz / 1000,
- (unsigned long) tsc_hz % 1000);
-
- if (!preset_lpj) {
- lpj = ((u64)tsc_hz * 1000);
- do_div(lpj, HZ);
- preset_lpj = lpj;
- }
-
- return...
2007 Apr 18
1
[PATCH 9/10] Vmi timer update.patch
...MI_PERIODIC, return the corresponding
+ * cycle counter. */
+ return flags & VMI_ALARM_COUNTER_MASK;
+}
+
+/* paravirt_ops.get_wallclock = vmi_get_wallclock */
+unsigned long vmi_get_wallclock(void)
+{
+ unsigned long long wallclock;
+ wallclock = vmi_timer_ops.get_wallclock(); // nsec
+ (void)do_div(wallclock, 1000000000); // sec
+
+ return wallclock;
+}
+
+/* paravirt_ops.set_wallclock = vmi_set_wallclock */
+int vmi_set_wallclock(unsigned long now)
+{
+ return 0;
+}
+
+/* paravirt_ops.get_scheduled_cycles = vmi_get_sched_cycles */
+unsigned long long vmi_get_sched_cycles(void)
+{
+ ret...
2007 Apr 18
1
[PATCH 9/10] Vmi timer update.patch
...MI_PERIODIC, return the corresponding
+ * cycle counter. */
+ return flags & VMI_ALARM_COUNTER_MASK;
+}
+
+/* paravirt_ops.get_wallclock = vmi_get_wallclock */
+unsigned long vmi_get_wallclock(void)
+{
+ unsigned long long wallclock;
+ wallclock = vmi_timer_ops.get_wallclock(); // nsec
+ (void)do_div(wallclock, 1000000000); // sec
+
+ return wallclock;
+}
+
+/* paravirt_ops.set_wallclock = vmi_set_wallclock */
+int vmi_set_wallclock(unsigned long now)
+{
+ return 0;
+}
+
+/* paravirt_ops.get_scheduled_cycles = vmi_get_sched_cycles */
+unsigned long long vmi_get_sched_cycles(void)
+{
+ ret...
2011 May 02
5
[PATCH v3 0/3] btrfs: quasi-round-robin for chunk allocation
In a multi device setup, the chunk allocator currently always allocates
chunks on the devices in the same order. This leads to a very uneven
distribution, especially with RAID1 or RAID10 and an uneven number of
devices.
This patch always sorts the devices before allocating, and allocates the
stripes on the devices with the most available space, as long as there
is enough space available. In a low
2015 Mar 13
0
[PATCH] sd, mmc, virtio_blk, string_helpers: fix block size units
...u32 remainder = 0, sf_cap, exp;
> char tmp[8];
> + const char *unit;
>
> tmp[0] = '\0';
> i = 0;
> - if (size >= divisor[units]) {
> - while (size >= divisor[units]) {
> - remainder = do_div(size, divisor[units]);
> - i++;
> - }
> + if (!size)
> + goto out;
>
> - sf_cap = size;
> - for (j = 0; sf_cap*10 < 1000; j++)
> - sf_cap *= 10;
> + while (b...
2015 Mar 13
0
[PATCH] sd, mmc, virtio_blk, string_helpers: fix block size units
...u32 remainder = 0, sf_cap, exp;
> char tmp[8];
> + const char *unit;
>
> tmp[0] = '\0';
> i = 0;
> - if (size >= divisor[units]) {
> - while (size >= divisor[units]) {
> - remainder = do_div(size, divisor[units]);
> - i++;
> - }
> + if (!size)
> + goto out;
>
> - sf_cap = size;
> - for (j = 0; sf_cap*10 < 1000; j++)
> - sf_cap *= 10;
> + while (b...
2011 Apr 12
3
[PATCH v2 0/3] btrfs: quasi-round-robin for chunk allocation
In a multi device setup, the chunk allocator currently always allocates
chunks on the devices in the same order. This leads to a very uneven
distribution, especially with RAID1 or RAID10 and an uneven number of
devices.
This patch always sorts the devices before allocating, and allocates the
stripes on the devices with the most available space, as long as there
is enough space available. In a low
2008 Jul 22
6
[PATCH 0/2] Paravirt loops per jiffy calculation
Hey,
Over the last weeks, there has been some discussion regarding paravirt
lpj calculation for kvm. Here's my shot at that.
KVM hypervisor already put the right value in our pvclock structures,
as part of the xen compatibility efforts.
So the first patch moves the respective xen code to pvclock.c (since
we'll be doing the same calculation anyway), while the second, implements
functions
2008 Jul 22
6
[PATCH 0/2] Paravirt loops per jiffy calculation
Hey,
Over the last weeks, there has been some discussion regarding paravirt
lpj calculation for kvm. Here's my shot at that.
KVM hypervisor already put the right value in our pvclock structures,
as part of the xen compatibility efforts.
So the first patch moves the respective xen code to pvclock.c (since
we'll be doing the same calculation anyway), while the second, implements
functions
2007 Apr 18
0
[PATCH 3/9] Vmi cpu cycles.patch
...:04:43 2007 -0800
+++ b/arch/i386/kernel/vmitime.c Tue Feb 27 14:06:46 2007 -0800
@@ -177,6 +177,15 @@ unsigned long long vmi_get_sched_cycles(
return read_available_cycles();
}
+unsigned long vmi_cpu_khz(void)
+{
+ unsigned long long khz;
+
+ khz = vmi_timer_ops.get_cycle_frequency();
+ (void)do_div(khz, 1000);
+ return khz;
+}
+
void __init vmi_time_init(void)
{
unsigned long long cycles_per_sec, cycles_per_msec;
@@ -206,7 +215,6 @@ void __init vmi_time_init(void)
(void)do_div(cycles_per_alarm, alarm_hz);
cycles_per_msec = cycles_per_sec;
(void)do_div(cycles_per_msec, 1000);
- cpu_k...
2007 Apr 18
0
[PATCH 3/9] Vmi cpu cycles.patch
...:04:43 2007 -0800
+++ b/arch/i386/kernel/vmitime.c Tue Feb 27 14:06:46 2007 -0800
@@ -177,6 +177,15 @@ unsigned long long vmi_get_sched_cycles(
return read_available_cycles();
}
+unsigned long vmi_cpu_khz(void)
+{
+ unsigned long long khz;
+
+ khz = vmi_timer_ops.get_cycle_frequency();
+ (void)do_div(khz, 1000);
+ return khz;
+}
+
void __init vmi_time_init(void)
{
unsigned long long cycles_per_sec, cycles_per_msec;
@@ -206,7 +215,6 @@ void __init vmi_time_init(void)
(void)do_div(cycles_per_alarm, alarm_hz);
cycles_per_msec = cycles_per_sec;
(void)do_div(cycles_per_msec, 1000);
- cpu_k...
2019 May 23
4
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
...> >
> > +# define roundup_64(x, y) ( \
> > +{ \
> > + typeof(y) __y = y; \
> > + typeof(x) __x = (x) + (__y - 1); \
> > + do_div(__x, __y); \
> > + __x * __y; \
> > +} \
>
> The thing about this is that it absolutely sucks for power-of-two arguments.
>
> The regular roundup()...
2019 May 23
0
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
...edt at goodmis.org> wrote:
>
> +# define roundup_64(x, y) ( \
> +{ \
> + typeof(y) __y = y; \
> + typeof(x) __x = (x) + (__y - 1); \
> + do_div(__x, __y); \
> + __x * __y; \
> +} \
The thing about this is that it absolutely sucks for power-of-two arguments.
The regular roundup() that uses division has the co...
2009 Aug 17
5
[PATCH 1/6] drm/i2c/ch7006: Fix some sparse warnings.
---
drivers/gpu/drm/i2c/ch7006_drv.c | 2 +-
drivers/gpu/drm/i2c/ch7006_mode.c | 2 +-
drivers/gpu/drm/i2c/ch7006_priv.h | 5 ++---
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
index c2594a1..7df4b86 100644
--- a/drivers/gpu/drm/i2c/ch7006_drv.c
+++ b/drivers/gpu/drm/i2c/ch7006_drv.c
@@ -351,7 +351,7
2009 Aug 05
3
RAID[56] with arbitrary numbers of "parity" stripes.
...t(u64, em->len - offset,
@@ -2818,8 +2799,7 @@ again:
current->pid % map->sub_stripes);
}
- } else if (map->type & (BTRFS_BLOCK_GROUP_RAID5 |
- BTRFS_BLOCK_GROUP_RAID6)) {
+ } else if (map->type & BTRFS_BLOCK_GROUP_RAID56) {
u64 tmp;
stripe_index = do_div(stripe_nr, nr_data_stripes(map));
@@ -2841,7 +2821,7 @@ again:
em->start + (tmp + i) * map->stripe_len;
raid_map[(i+rot) % map->num_stripes] = RAID5_P_STRIPE;
- if (map->type & BTRFS_BLOCK_GROUP_RAID6)
+ if ((map->type >> 56) >= 2)
raid_map[(i+rot+1)...
2009 Aug 17
5
[PATCHv2 1/6] drm/i2c/ch7006: Fix some sparse warnings.
Signed-off-by: Francisco Jerez <currojerez at riseup.net>
---
drivers/gpu/drm/i2c/ch7006_drv.c | 2 +-
drivers/gpu/drm/i2c/ch7006_mode.c | 2 +-
drivers/gpu/drm/i2c/ch7006_priv.h | 5 ++---
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
index c2594a1..7df4b86 100644
---